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 tool_choice, response_format, and top_p to assistant RunRequest #754

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

TheAdamSmith
Copy link
Contributor

Describe the change
Adds the tool_choice, response_format, and top_p params to the RunRequest object to match AssistantsV2
https://platform.openai.com/docs/assistants/whats-new
These all don't require any additional implementation. Left out the stream option since that is not yet supported.

Provide OpenAI documentation link
https://platform.openai.com/docs/api-reference/runs/createRun

Describe your solution
This just adds the fields to the struct so that they can be passed in the request body. These are just extra params that are ignored when passed to Assistants V1. So they should be safe to add.

Tests
Unit tests run successfully.
Getting the following error when running the integration tests

    api_integration_test.go:86: error, status code: 404, message: The model `ada` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations [
CreateCompletionStream returned error]
--- FAIL: TestAPI (2.53s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6a7cf4]

But this seems unrelated to my change since these tests are not invoking the assistants api. LMK if this test failure is a user error.

I did test making a request with both Assistants V1 and V2 and both worked.

Issue: #753

Copy link

codecov bot commented May 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.68%. Comparing base (774fc9d) to head (9e9dbcb).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #754      +/-   ##
==========================================
+ Coverage   98.46%   98.68%   +0.22%     
==========================================
  Files          24       24              
  Lines        1364     1140     -224     
==========================================
- Hits         1343     1125     -218     
+ Misses         15        9       -6     
  Partials        6        6              

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

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

Integration tests are definitely an area for improvement for us — we should fix them and start running on every merge to the master branch

@sashabaranov sashabaranov merged commit 30cf7b8 into sashabaranov:master Jun 3, 2024
3 checks passed
@TheAdamSmith
Copy link
Contributor Author

Thank you for the PR!

Integration tests are definitely an area for improvement for us — we should fix them and start running on every merge to the master branch

Yeah of course! I created an issue for the integration tests and will see if I can get to it this week

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.

None yet

2 participants