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 implement Run APIs #560

Merged
merged 14 commits into from
Nov 9, 2023

Conversation

henomis
Copy link
Contributor

@henomis henomis commented Nov 9, 2023

Describe the change
This branch implements Run APIs

Issue: #533

⚠️ It's a lot of code, I need some help from the go-openai community to test/review this one before merging it.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #560 (343ce4f) into master (78862a2) will increase coverage by 0.26%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #560      +/-   ##
==========================================
+ Coverage   97.95%   98.22%   +0.26%     
==========================================
  Files          21       22       +1     
  Lines        1026     1181     +155     
==========================================
+ Hits         1005     1160     +155     
  Misses         15       15              
  Partials        6        6              
Files Coverage Δ
run.go 100.00% <100.00%> (ø)

@henomis henomis marked this pull request as ready for review November 9, 2023 08:54
@henomis henomis mentioned this pull request Nov 9, 2023
@sashabaranov
Copy link
Owner

Thank you for the PR! ❤️ We would need to add some integration tests for Assistants API at some point in the future

run.go Outdated
Comment on lines 255 to 262
func (c *Client) SubmitToolOutputs(
ctx context.Context,
threadID string,
runID string,
request SubmitToolOutputsRequest) (response Run, err error) {
urlSuffix := fmt.Sprintf("/threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL(urlSuffix), withBody(request),
withBetaAssistantV1())
Copy link
Owner

Choose a reason for hiding this comment

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

nit: could we please either use single-line or all-in multiple lines, so here it would be

func (c *Client) SubmitToolOutputs(
	ctx context.Context,
	threadID string,
	runID string,
	request SubmitToolOutputsRequest,
) (response Run, err error) {
	urlSuffix := fmt.Sprintf("/threads/%s/runs/%s/submit_tool_outputs", threadID, runID)
	req, err := c.newRequest(
		ctx,
		http.MethodPost,
		c.fullURL(urlSuffix),
		withBody(request),
		withBetaAssistantV1(),
	)

run.go Outdated
limit *int,
order *string,
after *string,
before *string,
Copy link
Owner

Choose a reason for hiding this comment

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

I wonder if we should pack all these arguments into a struct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@sashabaranov sashabaranov merged commit d6f3bdc into sashabaranov:master Nov 9, 2023
3 checks passed
maerlyn5 pushed a commit to prassoai/go-openai that referenced this pull request Nov 22, 2023
* chore: first commit

* add apis

* chore: add tests

* feat add apis

* chore: add api and tests

* chore: add tests

* fix

* trigger build

* fix

* chore: formatting code

* chore: add pagination type
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