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

Add completion-with-tool example #598

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

mikeb26
Copy link
Contributor

@mikeb26 mikeb26 commented Nov 18, 2023

Describe the change
Add a completion-with-tool example showing how to correctly utilize the function calling capability of GPT4

Describe your solution
This is based on the existing completion example and uses the same get_current_weather() python function that the OpenAI documentation includes.

Tests
Manually run the new example.

Additional context
As a user of this go SDK it was not immediately intuitive to me how to correctly utilize the function calling capability of GPT4 (https://platform.openai.com/docs/guides/function-calling). While the aformentioned link provides a helpful example written in python, I initially tripped over how to correctly translate the specification of function arguments when using this go SDK.

As a user of this go SDK it was not immediately intuitive to me how to
correctly utilize the function calling capability of GPT4
(https://platform.openai.com/docs/guides/function-calling). While the
aformentioned link provides a helpful example written in python, I
initially tripped over how to correclty translate the specification of
function arguments when usingthis go SDK.

To make it easier for others in the future this commit adds a
completion-with-tool example showing how to correctly utilize the
function calling capability of GPT4 using this SDK end-to-end in a
CreateChatCompletion() sequence.
Copy link

codecov bot commented Nov 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a130cfe) 98.38% compared to head (8ea0d17) 98.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #598   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files          24       24           
  Lines        1300     1300           
=======================================
  Hits         1279     1279           
  Misses         15       15           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sashabaranov
Copy link
Owner

Thank you for the PR! Looks good!

@sashabaranov sashabaranov merged commit a09cb0c into sashabaranov:master Nov 26, 2023
3 checks passed
@mikeb26 mikeb26 deleted the functionExample branch January 29, 2024 17:11
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.

2 participants