Skip to content

Commit

Permalink
llama_leap client setup
Browse files Browse the repository at this point in the history
  • Loading branch information
monofuel committed Jan 13, 2024
1 parent 334abc1 commit b0c92bf
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 11 deletions.
8 changes: 4 additions & 4 deletions nimtemplate.nimble
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = "0.0.0"
author = "Your name"
description = "Description of your library"
version = "0.0.1"
author = "Andrew Brower"
description = "Ollama API for Nim"
license = "MIT"

srcDir = "src"

requires "nim >= 1.2.2"
requires "nim >= 2.0.0"
23 changes: 23 additions & 0 deletions src/llama_leap.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import curly

## ollama API Interface
## https://github.com/jmorganca/ollama/blob/main/docs/api.md

type
OllamaAPI* = ref object
curlPool: CurlPool
url: string
curlTimeout: float32

proc newOllamaAPI*(
url: string = "http://localhost:11434/api",
curlPoolSize: int = 4,
curlTimeout: float32 = 10000
): OllamaAPI =
result = OllamaAPI()
result.curlPool = newCurlPool(curlPoolSize)
result.url = url
result.curlTimeout = curlTimeout

proc close*(api: OllamaAPI) =
api.curlPool.close()
3 changes: 0 additions & 3 deletions src/nimtemplate.nim

This file was deleted.

1 change: 0 additions & 1 deletion src/nimtemplate/common.nim

This file was deleted.

3 changes: 0 additions & 3 deletions tests/test.nim

This file was deleted.

16 changes: 16 additions & 0 deletions tests/test_llama_leap.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## llama_leap API tests
## Ensure that ollama is running!

import llama_leap, unittest


suite "llama_leap":
var ollama: OllamaAPI

setup:
ollama = newOllamaApi()
teardown:
ollama.close()

test "TODO":
echo "TODO"

0 comments on commit b0c92bf

Please sign in to comment.