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 vector store endpoints #472

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

willywg
Copy link

@willywg willywg commented Apr 30, 2024

Hi...

I'm excited to submit this PR for the issue #463: "Add the Vector Store, Vector Store Files, and Vector Store Batch Files APIs." With the recent release of OpenAI's Assistant V2, new endpoints have been introduced, including VectorStores, VectorStoreFiles, and VectorStoreBatchFiles. These endpoints are essential for leveraging the enhanced capabilities of the updated Assistant.

In this PR, I have implemented these new endpoints, ensuring compatibility and extending our API's functionality. Additionally, I have updated the README.md with usage examples to facilitate a better understanding for developers integrating these services.

Please find below the summary of changes:

  • Added new API endpoints for VectorStores, VectorStoreFiles, and VectorStoreBatchFiles.
  • Updated the README.md with clear and concise examples for each of the new endpoints.
  • Ensured that all changes adhere to the existing code standards and practices.

Best regards.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?

… OpenAI client

This commit adds tests for the vector stores endpoints in the OpenAI client. The tests cover the following functionality:

- `#list`: verifies that the response contains a vector store object
- `#retrieve`: verifies that the response contains a vector store object
- `#create`: verifies that the response contains a vector store object
- `#modify`: verifies that the response contains a vector store object
- `#delete`: verifies that the response contains a vector store.deleted object

These tests ensure that the vector stores functionality in the OpenAI client is working correctly.
… and deleting vector stores

feat(vector_stores_create): add support for creating a vector store by sending a POST request to the API with the necessary parameters

feat(vector_stores_delete): add support for deleting a vector store by sending a DELETE request to the API with the vector store ID

feat(vector_stores_modify): add support for modifying a vector store by sending a POST request to the API with the vector store ID and the updated metadata

feat(vector_stores_retrieve): add support for retrieving a vector store by sending a GET request to the API with the vector store ID
- Added `require_relative "openai/vector_stores"` to `lib/openai.rb` to include the vector stores module.
- Added `def vector_stores` method to `lib/openai/client.rb` to initialize and return an instance of `OpenAI::VectorStores`.
- Added `lib/openai/vector_stores.rb` file to define the `OpenAI::VectorStores` class with methods for listing, retrieving, creating, modifying, and deleting vector stores.
…nctionality

This commit adds tests for the functionality related to vector store files in the OpenAI client. The tests cover the following scenarios:

- `#list`: verifies that the list operation succeeds and returns the expected object type.
- `#retrieve`: verifies that the retrieve operation succeeds and returns the expected object type.
- `#create`: verifies that the create operation succeeds and returns the expected object type.
- `#delete`: verifies that the delete operation succeeds and returns the expected object type.

These tests ensure that the vector store files functionality is working correctly and can be used to manage vector store files effectively.
…d deleting files in a vector store

This commit adds support for creating, retrieving, listing, and deleting files in a vector store. The changes include the following:

1. Added support for creating a file in a vector store.
2. Added support for retrieving a file from a vector store.
3. Added support for listing all files in a vector store.
4. Added support for deleting a file from a vector store.

These changes enable users to perform CRUD operations on files within a vector store, providing more flexibility and control over the data stored in the vector store.
This commit adds a new file `vector_store_files.rb` to the `openai` library. The `VectorStoreFiles` class is implemented, which provides methods for interacting with vector store files. The class includes methods for listing, retrieving, creating, and deleting vector store files. This addition enhances the functionality of the `openai` library by allowing users to manage vector store files.
…ile batches functionality

This commit adds tests for the `vector_store_file_batches` functionality in the `OpenAI::Client` class. The tests cover the following methods:

- `#list`: Tests that the list method returns the expected response object.
- `#retrieve`: Tests that the retrieve method returns the expected response object.
- `#create`: Tests that the create method returns the expected response object.
- `#cancel`: Tests that the cancel method returns the expected response object.

These tests ensure that the `vector_store_file_batches` functionality is working correctly and can be used to interact with vector store file batches.
…ctor store

This commit adds the functionality to retrieve file batches from a vector store. The changes include the addition of new API endpoints and the necessary logic to handle the retrieval of file batches.

The following files were added or modified:
- `vector_store_file_batches_retrieve.yml`: Added a new cassette file to capture the HTTP interactions for retrieving file batches from a vector store.
- `vector_store_file_batches_retrieve_vector_store_setup.yml`: Added a new cassette file to capture the HTTP interactions for setting up a vector store for retrieving file batches.
- `vector_store_file_batches_retrieve_file_setup.yml`: Added a new cassette file to capture the HTTP interactions for setting up a file for retrieving file batches.
- `vector_store_file_batches_retrieve_vector_store_file_batch_setup.yml`: Added a new cassette file to capture the HTTP interactions for setting up a vector store file batch for retrieving file batches.

These changes were made to enhance the functionality of the vector store feature and improve the overall user experience.
…vector store file batch operations

feat(client.rb): add vector_store_file_batches method to OpenAI::Client to access vector store file batch operations
feat(vector_store_file_batches.rb): create VectorStoreFileBatches class to handle vector store file batch operations
…les, and vector store file batches to provide information on how to manage and interact with vector stores in the API

feat(README.md): add support for file search tool in the assistant by including it as a tool resource in the assistant creation request
@bvsatyaram
Copy link

bvsatyaram commented May 14, 2024

I have been working on this branch for a couple of days. It is stable and works as expected. I think it is good to go.

@alexrudall - When can we get this merged?

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
willywg and others added 2 commits May 15, 2024 17:27
Co-authored-by: Adam Naamani <[email protected]>
Co-authored-by: Adam Naamani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants