Skip to content

Commit fdfda7f

Browse files
authored
Merge pull request #18 from enoch3712/17-ollama-support-for-local-llms
Ollama support added. With a test connecting to a phi-3 mini model
2 parents 5e3126c + ae19a39 commit fdfda7f

File tree

4 files changed

+147
-36
lines changed

4 files changed

+147
-36
lines changed

extract_thinker/llm.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77

88
class LLM:
9-
def __init__(self, model: str):
9+
def __init__(self, model: str, api_base: str = None, api_key: str = None, api_version: str = None):
1010
self.client = instructor.from_litellm(litellm.completion, mode=instructor.Mode.MD_JSON)
1111
self.model = model
1212
self.router = None
13+
self.api_base = api_base
14+
self.api_key = api_key
15+
self.api_version = api_version
1316

1417
def load_router(self, router: Router) -> None:
1518
self.router = router
@@ -31,7 +34,10 @@ def request(self, messages: List[Dict[str, str]], response_model: str) -> Any:
3134
model=self.model,
3235
max_tokens=max_tokens,
3336
messages=messages,
34-
response_model=response_model
37+
response_model=response_model,
38+
api_base=self.api_base,
39+
api_key=self.api_key,
40+
api_version=self.api_version
3541
)
3642

3743
return response

poetry.lock

+105-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "extract_thinker"
3-
version = "0.0.5"
3+
version = "0.0.6"
44
description = "Library to extract data from files and documents agnositicaly using LLMs"
55
authors = ["Júlio Almeida <[email protected]>"]
66
readme = "README.md"

0 commit comments

Comments
 (0)