Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aflament committed Jun 22, 2024
1 parent b1ee415 commit da1bfa7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions council/llm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ def _build_llm(llm_config: LLMConfigObject) -> LLMBase:
return OpenAILLM.from_config(llm_config)
elif provider.is_of_kind(LLMProviders.Anthropic):
return AnthropicLLM.from_config(llm_config)
elif provider.is_of_kind(LLMProviders.Gemini):
return GeminiLLM.from_config(llm_config)

raise ValueError(f"Provider `{provider.kind}` not supported by Council")
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ beautifulsoup4~=4.12.2

toml~=0.10.2
nbformat~=5.9.2
nbconvert~=7.11.0
PyYAML~=6.0.1
15 changes: 14 additions & 1 deletion tests/unit/llm/test_llm_config_object.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from council import OpenAILLM, AzureLLM, AnthropicLLM
from council import OpenAILLM, AzureLLM, AnthropicLLM, GeminiLLM
from council.llm import get_llm_from_config, LLMFallback, OpenAIChatGPTConfiguration
from council.llm.llm_config_object import LLMConfigObject
from council.utils import OsEnviron
Expand Down Expand Up @@ -52,6 +52,19 @@ def test_anthropic_from_yaml():
assert isinstance(llm, AnthropicLLM)


def test_gemini_from_yaml():
filename = get_data_filename(LLModels.Gemini)

with OsEnviron("GEMINI_API_KEY", "a-key"):
actual = LLMConfigObject.from_yaml(filename)
llm = GeminiLLM.from_config(actual)
assert isinstance(llm, GeminiLLM)
assert llm.configuration.top_k.value == 8

llm = get_llm_from_config(filename)
assert isinstance(llm, GeminiLLM)


def test_azure_with_openai_fallback_from_yaml():
filename = get_data_filename(LLModels.AzureWithFallback)

Expand Down

0 comments on commit da1bfa7

Please sign in to comment.