Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

anthropic[patch]: handle lists in function calling #18609

Merged

Conversation

efriis
Copy link
Member

@efriis efriis commented Mar 5, 2024

No description provided.

Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git 鈫楋笌

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain 猬滐笍 Ignored (Inspect) Visit Preview Mar 5, 2024 10:16pm

@efriis efriis added the partner label Mar 5, 2024
@efriis efriis self-assigned this Mar 5, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 馃攲: anthropic Primarily related to Anthropic integrations 馃:improvement Medium size change to existing code to handle new use-cases labels Mar 5, 2024
Comment on lines +76 to +78
return json.dumps({"anyOf": parameter["anyOf"]})
if "allOf" in parameter:
return json.dumps({"allOf": parameter["allOf"]})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dumping json schema like js

if tool["parameters"]["properties"][key][
"type"
] == "array" and not isinstance(value, list):
arguments[key] = [value]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crawl for list

and isinstance(value, dict)
and len(value.keys()) == 1
):
arguments[key] = list(value.values())[0]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crawl for objects like {"item": "my string"} that should really just be "my string"

@efriis efriis merged commit e169ee8 into master Mar 5, 2024
20 checks passed
@efriis efriis deleted the erick/anthropic-patch-handle-lists-in-function-calling branch March 5, 2024 22:19
thebhulawat pushed a commit to thebhulawat/langchain that referenced this pull request Mar 6, 2024
bechbd pushed a commit to bechbd/langchain that referenced this pull request Mar 29, 2024
gkorland pushed a commit to FalkorDB/langchain that referenced this pull request Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃攲: anthropic Primarily related to Anthropic integrations 馃:improvement Medium size change to existing code to handle new use-cases partner size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant