Skip to content

Add function call request param #79

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

Merged
merged 6 commits into from
Jun 24, 2023
Merged

Add function call request param #79

merged 6 commits into from
Jun 24, 2023

Conversation

DaviRain-Su
Copy link
Contributor

@DaviRain-Su DaviRain-Su commented Jun 19, 2023

close: #72
#76

  • Remove example/Cargo.toml, add to root Cargo.toml
  • Add function-call example get_current_weather

@b0xtch
Copy link

b0xtch commented Jun 20, 2023

I would also update the readme to add function as feature

get current weather
@DaviRain-Su
Copy link
Contributor Author

I am currently writing an example code for function calls, but I encountered an issue with the error: JSONDeserialize(Error("invalid type: null, expected a string", line: 11, column: 23)). I need some help to resolve this.

@64bit
Copy link
Owner

64bit commented Jun 21, 2023

Hi @DaviRain-Su, Thank you for the PR and adding example for this new feature - its a great way to test it.

Here are some hints for you to debug this further:

  • see the updated upstream OpenAPI spec and match it with Rust type in code
  • setup tracing_subscriber so that tracing::error!( ... ) can log the actualy json payload causing deserializtion error. examples/rate-limit-completions has an example - however you might need to change log level.

Hope this helps

@DaviRain-Su
Copy link
Contributor Author

Successfully added an example that can use function calls.

Copy link
Owner

@64bit 64bit left a comment

Choose a reason for hiding this comment

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

It appears that naming does not adheres to OpenAPI spec.

For example ChatCompletionFunctions , Please see the names of new types in this PR #73 - that's the unfortunate part of having types hand written instead of having it auto generated. That said, naming should be consistent with rest of the project

For background: all/majority of types in types.rs are named based on OpenAPI component schema.

…ontrolling how the model responds to function calls, and adds options for generating multiple completions.
@DaviRain-Su
Copy link
Contributor Author

Have fix all.

@64bit
Copy link
Owner

64bit commented Jun 24, 2023

function_call in ChatCompletionRequestMessage and ChatCompletionResponseMessage can also be a struct with name and arguments - I'll take care of it before publishing.

Thank you for addressing the comments, nice work on the new example!

@64bit 64bit merged commit 5077eeb into 64bit:main Jun 24, 2023
@64bit
Copy link
Owner

64bit commented Jun 24, 2023

This is released in v0.12.0

@DaviRain-Su DaviRain-Su deleted the add-function-call branch June 25, 2023 01:44
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.

Add support for functions
3 participants