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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update function calling docs #673

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Update function calling docs #673

merged 1 commit into from
Oct 23, 2023

Conversation

kevinjyee
Copy link
Contributor

@kevinjyee kevinjyee commented Oct 23, 2023

Update Function Calling Examples

Description of Changes

  1. Added a docstring to get_current_weather
    litellm.utils.function_to_dict(get_current_weather) on a function without a docstring will result in a NoneType exception.

  2. Made functions an array before passing it as a paremter into completion

  3. Updated API key to use Anthropic API Key for the claude examples

@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 23, 2023 5:09pm


functions = litellm.utils.function_to_dict(get_current_weather)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling function_to_dict on get_current_weather results in a NoneType exception; A docstring must be present.

if location == "Boston, MA":
return "The weather is 12F"

functions = [litellm.utils.function_to_dict(get_current_weather)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made functions to a list.

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

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

lgtm!

@ishaan-jaff
Copy link
Contributor

Thanks for this awesome PR @kevinjyee !

@ishaan-jaff ishaan-jaff merged commit e1b873a into BerriAI:main Oct 23, 2023
@krrishdholakia
Copy link
Contributor

Amazing PR - thank you for this @kevinjyee

@krrishdholakia
Copy link
Contributor

For non-openai models, our function calling can be improved, as we currently return the answer in ['choices'][0]['message']['content'] which is not how openai does it

Screenshot 2023-10-23 at 12 09 25 PM

open to suggestions for how we can return things in a more consistent format here: @kevinjyee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants