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

Feat Support tools and tools choice new fileds #526

Merged

Conversation

henomis
Copy link
Contributor

@henomis henomis commented Nov 7, 2023

Describe the change
This branch adds support for new fields tools and tool_choice

Describe your solution
New types have been added to support new features

@henomis henomis marked this pull request as ready for review November 7, 2023 01:10
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #526 (55a6469) into master (d07833e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #526   +/-   ##
=======================================
  Coverage   97.59%   97.59%           
=======================================
  Files          19       19           
  Lines         872      872           
=======================================
  Hits          851      851           
  Misses         15       15           
  Partials        6        6           
Files Coverage Δ
chat.go 100.00% <ø> (ø)
chat_stream.go 100.00% <ø> (ø)

@sashabaranov
Copy link
Owner

Thank you for the PR!

@@ -9,6 +9,7 @@ type ChatCompletionStreamChoiceDelta struct {
Content string `json:"content,omitempty"`
Role string `json:"role,omitempty"`
FunctionCall *FunctionCall `json:"function_call,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
Copy link
Owner

Choose a reason for hiding this comment

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

I don't see this field in the docs, is it undocumented yet? https://platform.openai.com/docs/api-reference/chat/streaming

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes documented here: "The chat completion chunk object" -> choices -> delta -> tool_calls

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks! Also noted: lots of things are marked as deprecated now, we should probably reflect those too #540

@sashabaranov sashabaranov merged commit 1ad6b6f into sashabaranov:master Nov 7, 2023
3 checks passed
FunctionCall any `json:"function_call,omitempty"`
Tools []Tool `json:"tools,omitempty"`
// This can be either a string or an ToolChoice object.
ToolChoiche any `json:"tool_choice,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Copy link
Contributor

Choose a reason for hiding this comment

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

fix included here #543

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.

4 participants