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: vectorStoresApi
url: ../openapi/openai-vector-stores-api-openapi.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
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.