Skip to content

Commit

Permalink
Merge pull request #13 from anthropics/model_default_update
Browse files Browse the repository at this point in the history
Model default update
  • Loading branch information
nmarwell-anthropic authored Mar 4, 2024
2 parents c21ac15 + 28bb346 commit a782267
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tool_use_package/tool_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ class ToolUser:
To use this class, you should instantiate it with a list of tools (tool_user = ToolUser(tools)). You then interact with it as you would the normal claude API, by providing a prompt to tool_user.use_tools(prompt) and expecting a completion in return.
"""

def __init__(self, tools, temperature=0, max_retries=3, first_party=True, model="claude-2.1"):
def __init__(self, tools, temperature=0, max_retries=3, first_party=True, model="default"):
self.tools = tools
self.temperature = temperature
self.max_retries = max_retries
self.first_party = first_party
if first_party:
self.model=model
if model == "default":
self.model = "claude-3-opus-20240229"
else:
self.model=model
self.client = Anthropic()
else:
if model == "claude-2.1" or model == "anthropic.claude-v2:1":
if model == "anthropic.claude-v2:1" or model == "default":
self.model = "anthropic.claude-v2:1"
else:
raise ValueError("Only Claude 2.1 is currently supported when working with bedrock in this sdk. If you'd like to use another model, please use the first party anthropic API (and set first_party=true).")
Expand Down
2 changes: 1 addition & 1 deletion tool_use_package/weather_tool_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def use_tool(self, city: str):
weather_tool = WeatherTool(tool_name, tool_description, tool_parameters)

# Pass the tool instance into the ToolUser
tool_user = ToolUser([weather_tool], first_party=False)
tool_user = ToolUser([weather_tool])

# Call the tool_user with a prompt to get a version of Claude that can use your tools!
if __name__ == '__main__':
Expand Down

0 comments on commit a782267

Please sign in to comment.