OpenAI · Arazzo Workflow

OpenAI Vector Store Search

Version 1.0.0

Attach a file to a vector store, wait until it is indexed, then run a semantic search.

1 workflow 1 source API 1 provider
View Spec View on GitHub AIArtificial IntelligenceLarge Language ModelsT1ArazzoWorkflows

Provider

openai

Workflows

vector-store-search
Ingest a file into a vector store and search it once indexing completes.
Attaches a file to a vector store, polls until the file is indexed, then searches the store for chunks relevant to the supplied query.
3 steps inputs: apiKey, fileId, query, vectorStoreId outputs: results, vectorStoreFileId
1
attachFile
createVectorStoreFile
Attach the uploaded file to the vector store.
2
pollFile
getVectorStoreFile
Poll the vector store file until indexing reaches a terminal status, branching to the search step when completed and looping while in progress.
3
search
searchVectorStore
Search the vector store for chunks relevant to the query.

Source API Descriptions

Arazzo Workflow Specification

openai-vector-store-search-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: OpenAI Vector Store Search
  summary: Attach a file to a vector store, wait until it is indexed, then run a semantic search.
  description: >-
    Attaches an already-uploaded file to an existing vector store, polls the
    vector store file until it is indexed, and then runs a semantic search query
    against the store, returning the matching chunks. The vector store endpoints
    require the OpenAI-Beta header, which is supplied inline on every step. Every
    step spells out its request inline so the flow can be read and executed
    without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: openaiApi
  url: ../openapi/openai-openapi-master.yml
  type: openapi
workflows:
- workflowId: vector-store-search
  summary: Ingest a file into a vector store and search it once indexing completes.
  description: >-
    Attaches a file to a vector store, polls until the file is indexed, then
    searches the store for chunks relevant to the supplied query.
  inputs:
    type: object
    required:
    - apiKey
    - vectorStoreId
    - fileId
    - query
    properties:
      apiKey:
        type: string
        description: OpenAI API key used as a Bearer token.
      vectorStoreId:
        type: string
        description: The id of an existing vector store to ingest into and search.
      fileId:
        type: string
        description: The id of a previously uploaded file to attach to the vector store.
      query:
        type: string
        description: The natural language query to search the vector store for.
  steps:
  - stepId: attachFile
    description: Attach the uploaded file to the vector store.
    operationId: createVectorStoreFile
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: vector_store_id
      in: path
      value: $inputs.vectorStoreId
    requestBody:
      contentType: application/json
      payload:
        file_id: $inputs.fileId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      vectorStoreFileId: $response.body#/id
      status: $response.body#/status
  - stepId: pollFile
    description: >-
      Poll the vector store file until indexing reaches a terminal status,
      branching to the search step when completed and looping while in progress.
    operationId: getVectorStoreFile
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: vector_store_id
      in: path
      value: $inputs.vectorStoreId
    - name: file_id
      in: path
      value: $steps.attachFile.outputs.vectorStoreFileId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      status: $response.body#/status
    onSuccess:
    - name: fileIndexed
      type: goto
      stepId: search
      criteria:
      - context: $response.body
        condition: $.status == "completed"
        type: jsonpath
    - name: fileIndexing
      type: goto
      stepId: pollFile
      criteria:
      - context: $response.body
        condition: $.status == "in_progress"
        type: jsonpath
  - stepId: search
    description: Search the vector store for chunks relevant to the query.
    operationId: searchVectorStore
    parameters:
    - name: Authorization
      in: header
      value: "Bearer $inputs.apiKey"
    - name: OpenAI-Beta
      in: header
      value: assistants=v2
    - name: vector_store_id
      in: path
      value: $inputs.vectorStoreId
    requestBody:
      contentType: application/json
      payload:
        query: $inputs.query
        max_num_results: 10
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      results: $response.body#/data
  outputs:
    vectorStoreFileId: $steps.attachFile.outputs.vectorStoreFileId
    results: $steps.search.outputs.results