Skip to content

Commit

Permalink
Finesse temperature passing
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed Feb 6, 2025
1 parent 534c145 commit 9fe8e1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/controlflow/llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def get_model(
"To use Google as an LLM provider, please install the `langchain_google_genai` package."
)
cls = ChatGoogleGenerativeAI
if temperature is None:
temperature = 0.7
elif provider == "groq":
try:
from langchain_groq import ChatGroq
Expand All @@ -60,6 +62,8 @@ def get_model(
"To use Groq as an LLM provider, please install the `langchain_groq` package."
)
cls = ChatGroq
if temperature is None:
temperature = 0.7
elif provider == "ollama":
try:
from langchain_ollama import ChatOllama
Expand All @@ -73,7 +77,9 @@ def get_model(
f"Could not load provider `{provider}` automatically. Please provide the LLM class manually."
)

return cls(model=model, temperature=temperature, **kwargs)
if temperature is not None:
kwargs["temperature"] = temperature
return cls(model=model, **kwargs)


def _get_initial_default_model() -> BaseChatModel:
Expand Down

0 comments on commit 9fe8e1b

Please sign in to comment.