Skip to content

Commit

Permalink
🐛 Bug: Fixed the bug where Claude did not correctly pass the model na…
Browse files Browse the repository at this point in the history
…me when using tools.
  • Loading branch information
yym68686 committed Oct 23, 2024
1 parent 1e075df commit ce08744
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="modelmerge",
version="0.11.57",
version="0.11.58",
description="modelmerge is a multi-large language model API aggregator.",
long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
long_description_content_type="text/markdown",
Expand Down
2 changes: 1 addition & 1 deletion src/ModelMerge/models/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class chatgpt(BaseLLM):
def __init__(
self,
api_key: str = None,
engine: str = os.environ.get("GPT_ENGINE") or "gpt-3.5-turbo",
engine: str = os.environ.get("GPT_ENGINE") or "gpt-4o",
api_url: str = (os.environ.get("API_URL") or "https://api.openai.com/v1/chat/completions"),
system_prompt: str = "You are ChatGPT, a large language model trained by OpenAI. Respond conversationally",
proxy: str = None,
Expand Down
6 changes: 3 additions & 3 deletions src/ModelMerge/models/claude.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class claude3(BaseLLM):
def __init__(
self,
api_key: str = None,
engine: str = os.environ.get("GPT_ENGINE") or "claude-3-opus-20240229",
engine: str = os.environ.get("GPT_ENGINE") or "claude-3-5-sonnet-20241022",
api_url: str = (os.environ.get("CLAUDE_API_URL") or "https://api.anthropic.com/v1/messages"),
system_prompt: str = "You are ChatGPT, a large language model trained by OpenAI. Respond conversationally",
temperature: float = 0.5,
Expand Down Expand Up @@ -449,7 +449,7 @@ def ask_stream(
response_role = "assistant"
if self.conversation[convo_id][-1]["role"] == "function" and self.conversation[convo_id][-1]["name"] == "get_search_results":
mess = self.conversation[convo_id].pop(-1)
yield from self.ask_stream(function_response, response_role, convo_id=convo_id, function_name=function_call_name, total_tokens=total_tokens, tools_id=tools_id, function_full_response=function_full_response, api_key=kwargs.get('api_key', self.api_key), plugins=kwargs.get("plugins", PLUGINS), system_prompt=system_prompt)
yield from self.ask_stream(function_response, response_role, convo_id=convo_id, function_name=function_call_name, total_tokens=total_tokens, model=model or self.engine, tools_id=tools_id, function_full_response=function_full_response, api_key=kwargs.get('api_key', self.api_key), plugins=kwargs.get("plugins", PLUGINS), system_prompt=system_prompt)
else:
if self.conversation[convo_id][-1]["role"] == "function" and self.conversation[convo_id][-1]["name"] == "get_search_results":
mess = self.conversation[convo_id].pop(-1)
Expand Down Expand Up @@ -609,7 +609,7 @@ async def ask_stream_async(
response_role = "assistant"
if self.conversation[convo_id][-1]["role"] == "function" and self.conversation[convo_id][-1]["name"] == "get_search_results":
mess = self.conversation[convo_id].pop(-1)
async for chunk in self.ask_stream_async(function_response, response_role, convo_id=convo_id, function_name=function_call_name, total_tokens=total_tokens, tools_id=tools_id, function_full_response=function_full_response, api_key=kwargs.get('api_key', self.api_key), plugins=kwargs.get("plugins", PLUGINS), system_prompt=system_prompt):
async for chunk in self.ask_stream_async(function_response, response_role, convo_id=convo_id, function_name=function_call_name, total_tokens=total_tokens, model=model or self.engine, tools_id=tools_id, function_full_response=function_full_response, api_key=kwargs.get('api_key', self.api_key), plugins=kwargs.get("plugins", PLUGINS), system_prompt=system_prompt):
yield chunk
# yield from self.ask_stream(function_response, response_role, convo_id=convo_id, function_name=function_call_name, total_tokens=total_tokens, tools_id=tools_id, function_full_response=function_full_response)
else:
Expand Down

0 comments on commit ce08744

Please sign in to comment.