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

Support Vector Store API #752

Closed
wants to merge 8 commits into from

Conversation

kodernubie
Copy link
Contributor

implement vector strore api (including vector file + file batch)

https://platform.openai.com/docs/api-reference/vector-stores

Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.80%. Comparing base (774fc9d) to head (a798d1e).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #752      +/-   ##
==========================================
+ Coverage   98.46%   98.80%   +0.34%     
==========================================
  Files          24       25       +1     
  Lines        1364     1257     -107     
==========================================
- Hits         1343     1242     -101     
+ Misses         15        9       -6     
  Partials        6        6              

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

@sashabaranov
Copy link
Owner

@kodernubie thank you for the PR!


// CreateVectorStore creates a new vector store.
func (c *Client) CreateVectorStore(ctx context.Context, request VectorStoreRequest) (response VectorStore, err error) {
req, _ := c.newRequest(ctx, http.MethodPost, c.fullURL(vectorStoresSuffix), withBody(request),
Copy link
Owner

Choose a reason for hiding this comment

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

Could we please have one-argument-per-line here and in all other cases in this PR? e.g.

req, _ := c.newRequest(ctx,
    http.MethodPost,
    c.fullURL(vectorStoresSuffix),
    withBody(request),
    withBetaAssistantVersion(c.config.AssistantVersion),
)

And also let's not ignore errors returned by c.newRequest

limit *int,
order *string,
after *string,
before *string,
Copy link
Owner

@sashabaranov sashabaranov Jun 3, 2024

Choose a reason for hiding this comment

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

Could we please use the Pagination struct here?

Copy link
Owner

Choose a reason for hiding this comment

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

We might as well put pagination into a separate file and provide a NoPagination = Pagination{} const

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.

Could we please use the Pagination struct here?

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.

Could we please use the Pagination struct here?

Completed: 1,
Failed: 0,
Cancelled: 0,
Total: 0,
Copy link
Owner

Choose a reason for hiding this comment

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

There's no need to specify 0 here and in the similar cases as 0 is the default value https://go.dev/tour/basics/12

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.

Please see earlier comments

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