openai-apigpt-4

Create Vector Store on OpenAI with curl, and Upload 2 PDfs to it with curl


I learned that OpenAI has integrated vector store now so I do not need an external vector database. So my question is if it is all possible with just API requests using curl

Can I create a vector store with curl .

and then upload 2 PDFs to vector with just a curl command.

And then I can ask quesiton also just with a curl.

i want to test it out only using API requests, and would be immensely amazing, if its possible ?


Solution

  • OpenAI documentation mention the vector DBS https://platform.openai.com/docs/assistants/tools/file-search/vector-stores

    It give the instruction to

    1. Creating vector stores and adding files
    2. Attaching vector stores
    3. Customizing File Search settings

    And the API calls that you need

    from openai import OpenAI
     
    client = OpenAI()
     
    assistant = client.beta.assistants.create(
      name="Financial Analyst Assistant",
      instructions="You are an expert financial analyst. Use you knowledge base to answer questions about audited financial statements.",
      model="gpt-4o",
      tools=[{"type": "file_search"}],
    )