Skip to content

Commit

Permalink
fix: ensure vectorStore is ready
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Aug 12, 2024
1 parent 11e0424 commit d4a2ab9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions services/non-named-votes-ai/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ export const ensureFile = async ({ pdfUrl, file_id }: { pdfUrl: string; file_id?

export const retriveVectorStore = async (vectorStoreId: string) =>
await openai.beta.vectorStores.retrieve(vectorStoreId);
export const createVectorStore = async ({ file_ids }: { file_ids: string[] }) =>
await openai.beta.vectorStores.create({
export const createVectorStore = async ({ file_ids }: { file_ids: string[] }) => {
const vectorStore = await openai.beta.vectorStores.create({});

await openai.beta.vectorStores.fileBatches.createAndPoll(vectorStore.id, {
file_ids,
});
return vectorStore;
};
export const ensureVectorStore = async ({
file_id,
vector_store_id,
Expand Down

0 comments on commit d4a2ab9

Please sign in to comment.