Skip to content

Commit

Permalink
adds claude models to makellm
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCox822 committed Aug 6, 2024
1 parent c221efb commit 7dd1361
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions mdagent/utils/makellm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain_openai import ChatOpenAI
from langchain_anthropic import ChatAnthropic


def _make_llm(model, temp, verbose):
Expand All @@ -11,25 +12,14 @@ def _make_llm(model, temp, verbose):
streaming=True if verbose else False,
callbacks=[StreamingStdOutCallbackHandler()] if verbose else None,
)
elif model.startswith("llama"):
from langchain_fireworks import ChatFireworks

llm = ChatFireworks(
elif model.startswith("claude"):
llm = ChatAnthropic(
temperature=temp,
model_name=f"accounts/fireworks/models/{model}",
request_timeout=1000,
model_name=model,
streaming=True if verbose else False,
callbacks=[StreamingStdOutCallbackHandler()] if verbose else None,
)
# elif model.startswith("Meta-Llama"):
# from langchain_together import ChatTogether
# llm = ChatTogether(
# temperature=temp,
# model=f"meta-llama/{model}",
# request_timeout=1000,
# streaming=True if verbose else False,
# callbacks=[StreamingStdOutCallbackHandler()] if verbose else None,
# )

else:
raise ValueError(f"Invalid or Unsupported model name: {model}")
return llm

0 comments on commit 7dd1361

Please sign in to comment.