Skip to content

Commit

Permalink
anthropic force tool (#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruppelt authored May 19, 2024
1 parent cd5169e commit 791384c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions instructor/process_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def handle_response_model(
elif mode == Mode.ANTHROPIC_TOOLS:
tool_descriptions = response_model.anthropic_schema
new_kwargs["tools"] = [tool_descriptions]
new_kwargs["tool_choice"] = {"type": "tool", "name": response_model.__name__}

system_messages = [
m["content"] for m in new_kwargs["messages"] if m["role"] == "system"
Expand Down
24 changes: 19 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pandas = { version = "^2.2.0", optional = true }
tabulate = { version = "^0.9.0", optional = true }
pydantic_extra_types = { version = "^2.6.0", optional = true }
litellm = { version = "^1.35.31", optional = true }
anthropic = { version = "^0.23.1", optional = true }
anthropic = { version = "^0.26.0", optional = true }
xmltodict = { version = "^0.13.0", optional = true }
groq = { version = "^0.4.2", optional = true }
cohere = { version = "^5.1.8", optional = true }
Expand Down Expand Up @@ -62,7 +62,7 @@ mkdocs-minify-plugin = "^0.8.0"
mkdocs-redirects = "^1.2.1"

[tool.poetry.group.anthropic.dependencies]
anthropic = "^0.23.1"
anthropic = "^0.26.0"

[tool.poetry.group.test-docs.dependencies]
fastapi = "^0.109.2"
Expand All @@ -72,7 +72,7 @@ pandas = "^2.2.0"
tabulate = "^0.9.0"
pydantic_extra_types = "^2.6.0"
litellm = "^1.35.31"
anthropic = "^0.23.1"
anthropic = "^0.26.0"
xmltodict = "^0.13.0"
groq = "^0.4.2"
phonenumbers = "^8.13.33"
Expand Down

0 comments on commit 791384c

Please sign in to comment.