Skip to content

Commit 35f2062

Browse files
authored
Merge pull request #53 from pattern-tech/fix/config-file
fix[api]: fixed needed llm host when provider is not ollama
2 parents acebf60 + 9a7424c commit 35f2062

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

api/src/util/configuration.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,22 @@ def _parse_config(self) -> dict:
3535
raise Exception(f"{agent}_API_KEY not found")
3636

3737
# load llm
38-
if os.environ["LLM_PROVIDER"] or os.environ["LLM_MODEL"]:
38+
if os.environ["LLM_PROVIDER"] and os.environ["LLM_MODEL"]:
39+
3940
config["llm"] = {
4041
"provider": os.environ["LLM_PROVIDER"],
4142
"model": os.environ["LLM_MODEL"],
42-
"api_key": os.environ["LLM_API_KEY"],
43-
"extra_params": {
43+
"api_key": os.environ["LLM_API_KEY"]
44+
}
45+
46+
if os.environ["LLM_PROVIDER"] == "ollama":
47+
config['llm']["extra_params"] = {
4448
"host": os.environ["LLM_HOST"],
4549
"models_path": os.environ["LLM_MODELS_PATH"]
4650
}
47-
}
4851
else:
4952
raise Exception(
50-
"LLM_PROVIDER or LLM_MODEL not set in .env")
53+
"LLM_PROVIDER and LLM_MODEL not set in .env")
5154

5255
# load services
5356
config["services"] = []

0 commit comments

Comments
 (0)