openapi: 3.0.0 info: title: OpenAI Assistants Vector stores API description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform. version: 2.0.0 termsOfService: https://openai.com/policies/terms-of-use contact: name: OpenAI Support url: https://help.openai.com/ license: name: MIT url: https://github.com/openai/openai-openapi/blob/master/LICENSE servers: - url: https://api.openai.com/v1 security: - ApiKeyAuth: [] tags: - name: Vector stores paths: /vector_stores: get: operationId: listVectorStores tags: - Vector stores summary: Returns a list of vector stores. parameters: - name: limit in: query description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. ' required: false schema: type: integer default: 20 - name: order in: query description: 'Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. ' schema: type: string default: desc enum: - asc - desc - name: after in: query description: 'A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. ' schema: type: string - name: before in: query description: 'A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. ' schema: type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ListVectorStoresResponse' x-oaiMeta: name: List vector stores group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.list()\npage = page.data[0]\nprint(page.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStores = await openai.vectorStores.list();\n console.log(vectorStores);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const vectorStore of client.vectorStores.list()) {\n console.log(vectorStore.id);\n}" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.List(context.TODO(), openai.VectorStoreListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStoreListPage;\nimport com.openai.models.vectorstores.VectorStoreListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreListPage page = client.vectorStores().list();\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.vector_stores.list puts(page)' response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n },\n {\n \"id\": \"vs_abc456\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ v2\",\n \"description\": null,\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n }\n ],\n \"first_id\": \"vs_abc123\",\n \"last_id\": \"vs_abc456\",\n \"has_more\": false\n}\n" post: operationId: createVectorStore tags: - Vector stores summary: Create a vector store. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateVectorStoreRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreObject' x-oaiMeta: name: Create vector store group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"name\": \"Support FAQ\"\n }'\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.create()\nprint(vector_store.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.create({\n name: \"Support FAQ\"\n });\n console.log(vectorStore);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.create();\n\nconsole.log(vectorStore.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.New(context.TODO(), openai.VectorStoreNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().create();\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store = openai.vector_stores.create puts(vector_store)' response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" /vector_stores/{vector_store_id}: get: operationId: getVectorStore tags: - Vector stores summary: Retrieves a vector store. parameters: - in: path name: vector_store_id required: true schema: type: string description: The ID of the vector store to retrieve. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreObject' x-oaiMeta: name: Retrieve vector store group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.retrieve(\n \"vector_store_id\",\n)\nprint(vector_store.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.retrieve(\n \"vs_abc123\"\n );\n console.log(vectorStore);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.retrieve('vector_store_id');\n\nconsole.log(vectorStore.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Get(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().retrieve(\"vector_store_id\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store = openai.vector_stores.retrieve("vector_store_id") puts(vector_store)' response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776\n}\n" post: operationId: modifyVectorStore tags: - Vector stores summary: Modifies a vector store. parameters: - in: path name: vector_store_id required: true schema: type: string description: The ID of the vector store to modify. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateVectorStoreRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreObject' x-oaiMeta: name: Modify vector store group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n -d '{\n \"name\": \"Support FAQ\"\n }'\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store = client.vector_stores.update(\n vector_store_id=\"vector_store_id\",\n)\nprint(vector_store.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStore = await openai.vectorStores.update(\n \"vs_abc123\",\n {\n name: \"Support FAQ\"\n }\n );\n console.log(vectorStore);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStore = await client.vectorStores.update('vector_store_id');\n\nconsole.log(vectorStore.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStore, err := client.VectorStores.Update(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStore.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStore;\nimport com.openai.models.vectorstores.VectorStoreUpdateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStore vectorStore = client.vectorStores().update(\"vector_store_id\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store = openai.vector_stores.update("vector_store_id") puts(vector_store)' response: "{\n \"id\": \"vs_abc123\",\n \"object\": \"vector_store\",\n \"created_at\": 1699061776,\n \"name\": \"Support FAQ\",\n \"description\": \"Contains commonly asked questions and answers, organized by topic.\",\n \"bytes\": 139920,\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 3\n }\n}\n" delete: operationId: deleteVectorStore tags: - Vector stores summary: Delete a vector store. parameters: - in: path name: vector_store_id required: true schema: type: string description: The ID of the vector store to delete. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/DeleteVectorStoreResponse' x-oaiMeta: name: Delete vector store group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_deleted = client.vector_stores.delete(\n \"vector_store_id\",\n)\nprint(vector_store_deleted.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStore = await openai.vectorStores.delete(\n \"vs_abc123\"\n );\n console.log(deletedVectorStore);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreDeleted = await client.vectorStores.delete('vector_store_id');\n\nconsole.log(vectorStoreDeleted.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreDeleted, err := client.VectorStores.Delete(context.TODO(), \"vector_store_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreDeleted.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStoreDeleteParams;\nimport com.openai.models.vectorstores.VectorStoreDeleted;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete(\"vector_store_id\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_deleted = openai.vector_stores.delete("vector_store_id") puts(vector_store_deleted)' response: "{\n id: \"vs_abc123\",\n object: \"vector_store.deleted\",\n deleted: true\n}\n" /vector_stores/{vector_store_id}/file_batches: post: operationId: createVectorStoreFileBatch tags: - Vector stores summary: Create a vector store file batch. description: 'The maximum number of files in a single batch request is 2000. Vector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`). For ingesting multiple files into the same vector store, this batch endpoint is recommended. ' parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: 'The ID of the vector store for which to create a File Batch. ' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateVectorStoreFileBatchRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileBatchObject' x-oaiMeta: name: Create vector store file batch group: vector_stores description: 'Attaches multiple files to a vector store in one request. This is the recommended approach for multi-file ingestion, especially because per-vector-store file attach writes are rate-limited (300 requests/minute shared with `/vector_stores/{vector_store_id}/files`). ' examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"files\": [\n {\n \"file_id\": \"file-abc123\",\n \"attributes\": {\"category\": \"finance\"}\n },\n {\n \"file_id\": \"file-abc456\",\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"max_chunk_size_tokens\": 1200,\n \"chunk_overlap_tokens\": 200\n }\n }\n ]\n }'\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.create(\n vector_store_id=\"vs_abc123\",\n)\nprint(vector_store_file_batch.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFileBatch = await openai.vectorStores.fileBatches.create(\n \"vs_abc123\",\n {\n files: [\n {\n file_id: \"file-abc123\",\n attributes: { category: \"finance\" },\n },\n {\n file_id: \"file-abc456\",\n chunking_strategy: {\n type: \"static\",\n max_chunk_size_tokens: 1200,\n chunk_overlap_tokens: 200,\n },\n },\n ]\n }\n );\n console.log(myVectorStoreFileBatch);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.create('vs_abc123');\n\nconsole.log(vectorStoreFileBatch.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileBatchNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchCreateParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create(\"vs_abc123\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file_batch = openai.vector_stores.file_batches.create("vs_abc123") puts(vector_store_file_batch)' response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" /vector_stores/{vector_store_id}/file_batches/{batch_id}: get: operationId: getVectorStoreFileBatch tags: - Vector stores summary: Retrieves a vector store file batch. parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: The ID of the vector store that the file batch belongs to. - in: path name: batch_id required: true schema: type: string example: vsfb_abc123 description: The ID of the file batch being retrieved. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileBatchObject' x-oaiMeta: name: Retrieve vector store file batch group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/file_batches/vsfb_abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.retrieve(\n batch_id=\"vsfb_abc123\",\n vector_store_id=\"vs_abc123\",\n)\nprint(vector_store_file_batch.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFileBatch = await openai.vectorStores.fileBatches.retrieve(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFileBatch);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.retrieve('vsfb_abc123', {\n vector_store_id: 'vs_abc123',\n});\n\nconsole.log(vectorStoreFileBatch.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"vsfb_abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileBatchRetrieveParams params = FileBatchRetrieveParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .batchId(\"vsfb_abc123\")\n .build();\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file_batch = openai.vector_stores.file_batches.retrieve("vsfb_abc123", vector_store_id: "vs_abc123") puts(vector_store_file_batch)' response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 1,\n \"completed\": 1,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 0,\n }\n}\n" /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel: post: operationId: cancelVectorStoreFileBatch tags: - Vector stores summary: Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. parameters: - in: path name: vector_store_id required: true schema: type: string description: The ID of the vector store that the file batch belongs to. - in: path name: batch_id required: true schema: type: string description: The ID of the file batch to cancel. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileBatchObject' x-oaiMeta: name: Cancel vector store file batch group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/cancel \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X POST\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_batch = client.vector_stores.file_batches.cancel(\n batch_id=\"batch_id\",\n vector_store_id=\"vector_store_id\",\n)\nprint(vector_store_file_batch.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFileBatch = await openai.vectorStores.fileBatches.cancel(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(deletedVectorStoreFileBatch);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileBatch = await client.vectorStores.fileBatches.cancel('batch_id', {\n vector_store_id: 'vector_store_id',\n});\n\nconsole.log(vectorStoreFileBatch.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileBatch, err := client.VectorStores.FileBatches.Cancel(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileBatch.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchCancelParams;\nimport com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileBatchCancelParams params = FileBatchCancelParams.builder()\n .vectorStoreId(\"vector_store_id\")\n .batchId(\"batch_id\")\n .build();\n VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file_batch = openai.vector_stores.file_batches.cancel("batch_id", vector_store_id: "vector_store_id") puts(vector_store_file_batch)' response: "{\n \"id\": \"vsfb_abc123\",\n \"object\": \"vector_store.file_batch\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"in_progress\",\n \"file_counts\": {\n \"in_progress\": 12,\n \"completed\": 3,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 15,\n }\n}\n" /vector_stores/{vector_store_id}/file_batches/{batch_id}/files: get: operationId: listFilesInVectorStoreBatch tags: - Vector stores summary: Returns a list of vector store files in a batch. parameters: - name: vector_store_id in: path description: The ID of the vector store that the files belong to. required: true schema: type: string - name: batch_id in: path description: The ID of the file batch that the files belong to. required: true schema: type: string - name: limit in: query description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. ' required: false schema: type: integer default: 20 - name: order in: query description: 'Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. ' schema: type: string default: desc enum: - asc - desc - name: after in: query description: 'A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. ' schema: type: string - name: before in: query description: 'A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. ' schema: type: string - name: filter in: query description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. schema: type: string enum: - in_progress - completed - failed - cancelled responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ListVectorStoreFilesResponse' x-oaiMeta: name: List vector store files in a batch group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files_batches/vsfb_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.file_batches.list_files(\n batch_id=\"batch_id\",\n vector_store_id=\"vector_store_id\",\n)\npage = page.data[0]\nprint(page.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.vectorStores.fileBatches.listFiles(\n \"vsfb_abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const vectorStoreFile of client.vectorStores.fileBatches.listFiles('batch_id', {\n vector_store_id: 'vector_store_id',\n})) {\n console.log(vectorStoreFile.id);\n}" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.FileBatches.ListFiles(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"batch_id\",\n\t\topenai.VectorStoreFileBatchListFilesParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.filebatches.FileBatchListFilesPage;\nimport com.openai.models.vectorstores.filebatches.FileBatchListFilesParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileBatchListFilesParams params = FileBatchListFilesParams.builder()\n .vectorStoreId(\"vector_store_id\")\n .batchId(\"batch_id\")\n .build();\n FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.vector_stores.file_batches.list_files("batch_id", vector_store_id: "vector_store_id") puts(page)' response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" /vector_stores/{vector_store_id}/files: get: operationId: listVectorStoreFiles tags: - Vector stores summary: Returns a list of vector store files. parameters: - name: vector_store_id in: path description: The ID of the vector store that the files belong to. required: true schema: type: string - name: limit in: query description: 'A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. ' required: false schema: type: integer default: 20 - name: order in: query description: 'Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. ' schema: type: string default: desc enum: - asc - desc - name: after in: query description: 'A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. ' schema: type: string - name: before in: query description: 'A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. ' schema: type: string - name: filter in: query description: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. schema: type: string enum: - in_progress - completed - failed - cancelled responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ListVectorStoreFilesResponse' x-oaiMeta: name: List vector store files group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.files.list(\n vector_store_id=\"vector_store_id\",\n)\npage = page.data[0]\nprint(page.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFiles = await openai.vectorStores.files.list(\n \"vs_abc123\"\n );\n console.log(vectorStoreFiles);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const vectorStoreFile of client.vectorStores.files.list('vector_store_id')) {\n console.log(vectorStoreFile.id);\n}" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.List(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\topenai.VectorStoreFileListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.files.FileListPage;\nimport com.openai.models.vectorstores.files.FileListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileListPage page = client.vectorStores().files().list(\"vector_store_id\");\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.vector_stores.files.list("vector_store_id") puts(page)' response: "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n },\n {\n \"id\": \"file-abc456\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abc123\"\n }\n ],\n \"first_id\": \"file-abc123\",\n \"last_id\": \"file-abc456\",\n \"has_more\": false\n}\n" post: operationId: createVectorStoreFile tags: - Vector stores summary: Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object). description: 'This endpoint is subject to a per-vector-store write rate limit of 300 requests per minute, shared with `/vector_stores/{vector_store_id}/file_batches`. For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume.' parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: 'The ID of the vector store for which to create a File. ' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateVectorStoreFileRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileObject' x-oaiMeta: name: Create vector store file group: vector_stores description: 'Attaches one file to a vector store. File attach writes are rate-limited per vector store (300 requests/minute shared with `/vector_stores/{vector_store_id}/file_batches`), so use file batches when uploading multiple files. ' examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -d '{\n \"file_id\": \"file-abc123\"\n }'\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file = client.vector_stores.files.create(\n vector_store_id=\"vs_abc123\",\n file_id=\"file_id\",\n)\nprint(vector_store_file.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const myVectorStoreFile = await openai.vectorStores.files.create(\n \"vs_abc123\",\n {\n file_id: \"file-abc123\"\n }\n );\n console.log(myVectorStoreFile);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFile = await client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' });\n\nconsole.log(vectorStoreFile.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.New(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreFileNewParams{\n\t\t\tFileID: \"file_id\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.files.FileCreateParams;\nimport com.openai.models.vectorstores.files.VectorStoreFile;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileCreateParams params = FileCreateParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .fileId(\"file_id\")\n .build();\n VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file = openai.vector_stores.files.create("vs_abc123", file_id: "file_id") puts(vector_store_file)' response: "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"usage_bytes\": 1234,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" /vector_stores/{vector_store_id}/files/{file_id}: get: operationId: getVectorStoreFile tags: - Vector stores summary: Retrieves a vector store file. parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: The ID of the vector store that the file belongs to. - in: path name: file_id required: true schema: type: string example: file-abc123 description: The ID of the file being retrieved. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileObject' x-oaiMeta: name: Retrieve vector store file group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\"\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file = client.vector_stores.files.retrieve(\n file_id=\"file-abc123\",\n vector_store_id=\"vs_abc123\",\n)\nprint(vector_store_file.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const vectorStoreFile = await openai.vectorStores.files.retrieve(\n \"file-abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(vectorStoreFile);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFile = await client.vectorStores.files.retrieve('file-abc123', {\n vector_store_id: 'vs_abc123',\n});\n\nconsole.log(vectorStoreFile.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Get(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.files.FileRetrieveParams;\nimport com.openai.models.vectorstores.files.VectorStoreFile;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileRetrieveParams params = FileRetrieveParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .fileId(\"file-abc123\")\n .build();\n VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file = openai.vector_stores.files.retrieve("file-abc123", vector_store_id: "vs_abc123") puts(vector_store_file)' response: "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null\n}\n" delete: operationId: deleteVectorStoreFile tags: - Vector stores summary: Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint. parameters: - in: path name: vector_store_id required: true schema: type: string description: The ID of the vector store that the file belongs to. - in: path name: file_id required: true schema: type: string description: The ID of the file to delete. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/DeleteVectorStoreFileResponse' x-oaiMeta: name: Delete vector store file group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123 \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -H \"OpenAI-Beta: assistants=v2\" \\\n -X DELETE\n" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file_deleted = client.vector_stores.files.delete(\n file_id=\"file_id\",\n vector_store_id=\"vector_store_id\",\n)\nprint(vector_store_file_deleted.id)" javascript: "import OpenAI from \"openai\";\nconst openai = new OpenAI();\n\nasync function main() {\n const deletedVectorStoreFile = await openai.vectorStores.files.delete(\n \"file-abc123\",\n { vector_store_id: \"vs_abc123\" }\n );\n console.log(deletedVectorStoreFile);\n}\n\nmain();\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFileDeleted = await client.vectorStores.files.delete('file_id', {\n vector_store_id: 'vector_store_id',\n});\n\nconsole.log(vectorStoreFileDeleted.id);" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFileDeleted, err := client.VectorStores.Files.Delete(\n\t\tcontext.TODO(),\n\t\t\"vector_store_id\",\n\t\t\"file_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFileDeleted.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.files.FileDeleteParams;\nimport com.openai.models.vectorstores.files.VectorStoreFileDeleted;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileDeleteParams params = FileDeleteParams.builder()\n .vectorStoreId(\"vector_store_id\")\n .fileId(\"file_id\")\n .build();\n VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") vector_store_file_deleted = openai.vector_stores.files.delete("file_id", vector_store_id: "vector_store_id") puts(vector_store_file_deleted)' response: "{\n id: \"file-abc123\",\n object: \"vector_store.file.deleted\",\n deleted: true\n}\n" post: operationId: updateVectorStoreFileAttributes tags: - Vector stores summary: Update attributes on a vector store file. parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: The ID of the vector store the file belongs to. - in: path name: file_id required: true schema: type: string example: file-abc123 description: The ID of the file to update attributes. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateVectorStoreFileAttributesRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileObject' x-oaiMeta: name: Update vector store file attributes group: vector_stores examples: request: curl: "curl https://api.openai.com/v1/vector_stores/{vector_store_id}/files/{file_id} \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"attributes\": {\"key1\": \"value1\", \"key2\": 2}}'\n" node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst vectorStoreFile = await client.vectorStores.files.update('file-abc123', {\n vector_store_id: 'vs_abc123',\n attributes: { foo: 'string' },\n});\n\nconsole.log(vectorStoreFile.id);" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvector_store_file = client.vector_stores.files.update(\n file_id=\"file-abc123\",\n vector_store_id=\"vs_abc123\",\n attributes={\n \"foo\": \"string\"\n },\n)\nprint(vector_store_file.id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvectorStoreFile, err := client.VectorStores.Files.Update(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t\topenai.VectorStoreFileUpdateParams{\n\t\t\tAttributes: map[string]openai.VectorStoreFileUpdateParamsAttributeUnion{\n\t\t\t\t\"foo\": {\n\t\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", vectorStoreFile.ID)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.JsonValue;\nimport com.openai.models.vectorstores.files.FileUpdateParams;\nimport com.openai.models.vectorstores.files.VectorStoreFile;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileUpdateParams params = FileUpdateParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .fileId(\"file-abc123\")\n .attributes(FileUpdateParams.Attributes.builder()\n .putAdditionalProperty(\"foo\", JsonValue.from(\"string\"))\n .build())\n .build();\n VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params);\n }\n}" ruby: "require \"openai\"\n\nopenai = OpenAI::Client.new(api_key: \"My API Key\")\n\nvector_store_file = openai.vector_stores.files.update(\n \"file-abc123\",\n vector_store_id: \"vs_abc123\",\n attributes: {foo: \"string\"}\n)\n\nputs(vector_store_file)" response: "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1699061776,\n \"vector_store_id\": \"vs_abcd\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {...},\n \"attributes\": {\"key1\": \"value1\", \"key2\": 2}\n}\n" /vector_stores/{vector_store_id}/files/{file_id}/content: get: operationId: retrieveVectorStoreFileContent tags: - Vector stores summary: Retrieve the parsed contents of a vector store file. parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: The ID of the vector store. - in: path name: file_id required: true schema: type: string example: file-abc123 description: The ID of the file within the vector store. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreFileContentResponse' x-oaiMeta: name: Retrieve vector store file content group: vector_stores examples: request: curl: 'curl \ https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123/content \ -H "Authorization: Bearer $OPENAI_API_KEY" ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const fileContentResponse of client.vectorStores.files.content('file-abc123', {\n vector_store_id: 'vs_abc123',\n})) {\n console.log(fileContentResponse.text);\n}" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.files.content(\n file_id=\"file-abc123\",\n vector_store_id=\"vs_abc123\",\n)\npage = page.data[0]\nprint(page.text)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Files.Content(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\t\"file-abc123\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.files.FileContentPage;\nimport com.openai.models.vectorstores.files.FileContentParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n FileContentParams params = FileContentParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .fileId(\"file-abc123\")\n .build();\n FileContentPage page = client.vectorStores().files().content(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.vector_stores.files.content("file-abc123", vector_store_id: "vs_abc123") puts(page)' response: "{\n \"file_id\": \"file-abc123\",\n \"filename\": \"example.txt\",\n \"attributes\": {\"key\": \"value\"},\n \"content\": [\n {\"type\": \"text\", \"text\": \"...\"},\n ...\n ]\n}\n" /vector_stores/{vector_store_id}/search: post: operationId: searchVectorStore tags: - Vector stores summary: Search a vector store for relevant chunks based on a query and file attributes filter. parameters: - in: path name: vector_store_id required: true schema: type: string example: vs_abc123 description: The ID of the vector store to search. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/VectorStoreSearchRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/VectorStoreSearchResultsPage' x-oaiMeta: name: Search vector store group: vector_stores examples: request: curl: 'curl -X POST \ https://api.openai.com/v1/vector_stores/vs_abc123/search \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d ''{"query": "What is the return policy?", "filters": {...}}'' ' node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const vectorStoreSearchResponse of client.vectorStores.search('vs_abc123', {\n query: 'string',\n})) {\n console.log(vectorStoreSearchResponse.file_id);\n}" python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.vector_stores.search(\n vector_store_id=\"vs_abc123\",\n query=\"string\",\n)\npage = page.data[0]\nprint(page.file_id)" go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.VectorStores.Search(\n\t\tcontext.TODO(),\n\t\t\"vs_abc123\",\n\t\topenai.VectorStoreSearchParams{\n\t\t\tQuery: openai.VectorStoreSearchParamsQueryUnion{\n\t\t\t\tOfString: openai.String(\"string\"),\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n" java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.vectorstores.VectorStoreSearchPage;\nimport com.openai.models.vectorstores.VectorStoreSearchParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VectorStoreSearchParams params = VectorStoreSearchParams.builder()\n .vectorStoreId(\"vs_abc123\")\n .query(\"string\")\n .build();\n VectorStoreSearchPage page = client.vectorStores().search(params);\n }\n}" ruby: 'require "openai" openai = OpenAI::Client.new(api_key: "My API Key") page = openai.vector_stores.search("vs_abc123", query: "string") puts(page)' response: "{\n \"object\": \"vector_store.search_results.page\",\n \"search_query\": \"What is the return policy?\",\n \"data\": [\n {\n \"file_id\": \"file_123\",\n \"filename\": \"document.pdf\",\n \"score\": 0.95,\n \"attributes\": {\n \"author\": \"John Doe\",\n \"date\": \"2023-01-01\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Relevant chunk\"\n }\n ]\n },\n {\n \"file_id\": \"file_456\",\n \"filename\": \"notes.txt\",\n \"score\": 0.89,\n \"attributes\": {\n \"author\": \"Jane Smith\",\n \"date\": \"2023-01-02\"\n },\n \"content\": [\n {\n \"type\": \"text\",\n \"text\": \"Sample text content from the vector store.\"\n }\n ]\n }\n ],\n \"has_more\": false,\n \"next_page\": null\n}\n" components: schemas: StaticChunkingStrategyRequestParam: type: object title: Static Chunking Strategy description: Customize your own chunking strategy by setting chunk size and chunk overlap. additionalProperties: false properties: type: type: string description: Always `static`. enum: - static x-stainless-const: true static: $ref: '#/components/schemas/StaticChunkingStrategy' required: - type - static VectorStoreFileObject: type: object title: Vector store files description: A list of files attached to a vector store. properties: id: description: The identifier, which can be referenced in API endpoints. type: string object: description: The object type, which is always `vector_store.file`. type: string enum: - vector_store.file x-stainless-const: true usage_bytes: description: The total vector store usage in bytes. Note that this may be different from the original file size. type: integer created_at: description: The Unix timestamp (in seconds) for when the vector store file was created. type: integer format: unixtime vector_store_id: description: The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to. type: string status: description: The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. type: string enum: - in_progress - completed - cancelled - failed last_error: anyOf: - type: object description: The last error associated with this vector store file. Will be `null` if there are no errors. properties: code: type: string description: One of `server_error`, `unsupported_file`, or `invalid_file`. enum: - server_error - unsupported_file - invalid_file message: type: string description: A human-readable description of the error. required: - code - message - type: 'null' chunking_strategy: type: object description: The strategy used to chunk the file. oneOf: - $ref: '#/components/schemas/StaticChunkingStrategyResponseParam' - $ref: '#/components/schemas/OtherChunkingStrategyResponseParam' attributes: $ref: '#/components/schemas/VectorStoreFileAttributes' required: - id - object - usage_bytes - created_at - vector_store_id - status - last_error x-oaiMeta: name: The vector store file object beta: true example: "{\n \"id\": \"file-abc123\",\n \"object\": \"vector_store.file\",\n \"usage_bytes\": 1234,\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"last_error\": null,\n \"chunking_strategy\": {\n \"type\": \"static\",\n \"static\": {\n \"max_chunk_size_tokens\": 800,\n \"chunk_overlap_tokens\": 400\n }\n }\n}\n" VectorStoreExpirationAfter: type: object title: Vector store expiration policy description: The expiration policy for a vector store. properties: anchor: description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.' type: string enum: - last_active_at x-stainless-const: true days: description: The number of days after the anchor time that the vector store will expire. type: integer minimum: 1 maximum: 365 required: - anchor - days CreateVectorStoreFileRequest: type: object additionalProperties: false properties: file_id: description: A [File](/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests. type: string chunking_strategy: $ref: '#/components/schemas/ChunkingStrategyRequestParam' attributes: $ref: '#/components/schemas/VectorStoreFileAttributes' required: - file_id StaticChunkingStrategy: type: object additionalProperties: false properties: max_chunk_size_tokens: type: integer minimum: 100 maximum: 4096 description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. chunk_overlap_tokens: type: integer description: 'The number of tokens that overlap between chunks. The default value is `400`. Note that the overlap must not exceed half of `max_chunk_size_tokens`. ' required: - max_chunk_size_tokens - chunk_overlap_tokens ListVectorStoreFilesResponse: properties: object: type: string example: list data: type: array items: $ref: '#/components/schemas/VectorStoreFileObject' first_id: type: string example: file-abc123 last_id: type: string example: file-abc456 has_more: type: boolean example: false required: - object - data - first_id - last_id - has_more ComparisonFilter: type: object additionalProperties: false title: Comparison Filter description: 'A filter used to compare a specified attribute key to a given value using a defined comparison operation. ' properties: type: type: string default: eq enum: - eq - ne - gt - gte - lt - lte - in - nin description: 'Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. - `eq`: equals - `ne`: not equal - `gt`: greater than - `gte`: greater than or equal - `lt`: less than - `lte`: less than or equal - `in`: in - `nin`: not in ' key: type: string description: The key to compare against the value. value: oneOf: - type: string - type: number - type: boolean - type: array items: oneOf: - type: string - type: number description: The value to compare against the attribute key; supports string, number, or boolean types. required: - type - key - value x-oaiMeta: name: ComparisonFilter VectorStoreFileContentResponse: type: object description: Represents the parsed content of a vector store file. properties: object: type: string enum: - vector_store.file_content.page description: The object type, which is always `vector_store.file_content.page` x-stainless-const: true data: type: array description: Parsed content of the file. items: type: object properties: type: type: string description: The content type (currently only `"text"`) text: type: string description: The text content has_more: type: boolean description: Indicates if there are more content pages to fetch. next_page: anyOf: - type: string description: The token for the next page, if any. - type: 'null' required: - object - data - has_more - next_page StaticChunkingStrategyResponseParam: type: object title: Static Chunking Strategy additionalProperties: false properties: type: type: string description: Always `static`. enum: - static x-stainless-const: true static: $ref: '#/components/schemas/StaticChunkingStrategy' required: - type - static VectorStoreObject: type: object title: Vector store description: A vector store is a collection of processed files can be used by the `file_search` tool. properties: id: description: The identifier, which can be referenced in API endpoints. type: string object: description: The object type, which is always `vector_store`. type: string enum: - vector_store x-stainless-const: true created_at: description: The Unix timestamp (in seconds) for when the vector store was created. type: integer format: unixtime name: description: The name of the vector store. type: string usage_bytes: description: The total number of bytes used by the files in the vector store. type: integer file_counts: type: object properties: in_progress: description: The number of files that are currently being processed. type: integer completed: description: The number of files that have been successfully processed. type: integer failed: description: The number of files that have failed to process. type: integer cancelled: description: The number of files that were cancelled. type: integer total: description: The total number of files. type: integer required: - in_progress - completed - failed - cancelled - total status: description: The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. type: string enum: - expired - in_progress - completed expires_after: $ref: '#/components/schemas/VectorStoreExpirationAfter' expires_at: anyOf: - description: The Unix timestamp (in seconds) for when the vector store will expire. type: integer format: unixtime - type: 'null' last_active_at: anyOf: - description: The Unix timestamp (in seconds) for when the vector store was last active. type: integer format: unixtime - type: 'null' metadata: $ref: '#/components/schemas/Metadata' required: - id - object - usage_bytes - created_at - status - last_active_at - name - file_counts - metadata x-oaiMeta: name: The vector store object example: "{\n \"id\": \"vs_123\",\n \"object\": \"vector_store\",\n \"created_at\": 1698107661,\n \"usage_bytes\": 123456,\n \"last_active_at\": 1698107661,\n \"name\": \"my_vector_store\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"cancelled\": 0,\n \"failed\": 0,\n \"total\": 100\n },\n \"last_used_at\": 1698107661\n}\n" UpdateVectorStoreFileAttributesRequest: type: object additionalProperties: false properties: attributes: $ref: '#/components/schemas/VectorStoreFileAttributes' required: - attributes x-oaiMeta: name: Update vector store file attributes request UpdateVectorStoreRequest: type: object additionalProperties: false properties: name: description: The name of the vector store. type: string nullable: true expires_after: allOf: - $ref: '#/components/schemas/VectorStoreExpirationAfter' - nullable: true metadata: $ref: '#/components/schemas/Metadata' DeleteVectorStoreFileResponse: type: object properties: id: type: string deleted: type: boolean object: type: string enum: - vector_store.file.deleted x-stainless-const: true required: - id - object - deleted VectorStoreFileAttributes: anyOf: - type: object description: 'Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers. ' maxProperties: 16 propertyNames: type: string maxLength: 64 additionalProperties: oneOf: - type: string maxLength: 512 - type: number - type: boolean x-oaiTypeLabel: map - type: 'null' CreateVectorStoreRequest: type: object additionalProperties: false properties: file_ids: description: A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. type: array maxItems: 500 items: type: string name: description: The name of the vector store. type: string description: description: A description for the vector store. Can be used to describe the vector store's purpose. type: string expires_after: $ref: '#/components/schemas/VectorStoreExpirationAfter' chunking_strategy: type: object description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty. oneOf: - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' metadata: $ref: '#/components/schemas/Metadata' CompoundFilter: $recursiveAnchor: true type: object additionalProperties: false title: Compound Filter description: Combine multiple filters using `and` or `or`. properties: type: type: string description: 'Type of operation: `and` or `or`.' enum: - and - or filters: type: array description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. items: oneOf: - $ref: '#/components/schemas/ComparisonFilter' - $recursiveRef: '#' discriminator: propertyName: type required: - type - filters x-oaiMeta: name: CompoundFilter Metadata: anyOf: - type: object description: 'Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. ' additionalProperties: type: string x-oaiTypeLabel: map - type: 'null' ChunkingStrategyRequestParam: type: object description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. oneOf: - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' discriminator: propertyName: type VectorStoreSearchResultContentObject: type: object additionalProperties: false properties: type: description: The type of content. type: string enum: - text text: description: The text content returned from search. type: string required: - type - text x-oaiMeta: name: Vector store search result content object ListVectorStoresResponse: properties: object: type: string example: list data: type: array items: $ref: '#/components/schemas/VectorStoreObject' first_id: type: string example: vs_abc123 last_id: type: string example: vs_abc456 has_more: type: boolean example: false required: - object - data - first_id - last_id - has_more VectorStoreSearchResultsPage: type: object additionalProperties: false properties: object: type: string enum: - vector_store.search_results.page description: The object type, which is always `vector_store.search_results.page` x-stainless-const: true search_query: type: array items: type: string description: The query used for this search. minItems: 1 data: type: array description: The list of search result items. items: $ref: '#/components/schemas/VectorStoreSearchResultItem' has_more: type: boolean description: Indicates if there are more results to fetch. next_page: anyOf: - type: string description: The token for the next page, if any. - type: 'null' required: - object - search_query - data - has_more - next_page x-oaiMeta: name: Vector store search results page DeleteVectorStoreResponse: type: object properties: id: type: string deleted: type: boolean object: type: string enum: - vector_store.deleted x-stainless-const: true required: - id - object - deleted VectorStoreSearchResultItem: type: object additionalProperties: false properties: file_id: type: string description: The ID of the vector store file. filename: type: string description: The name of the vector store file. score: type: number description: The similarity score for the result. minimum: 0 maximum: 1 attributes: $ref: '#/components/schemas/VectorStoreFileAttributes' content: type: array description: Content chunks from the file. items: $ref: '#/components/schemas/VectorStoreSearchResultContentObject' required: - file_id - filename - score - attributes - content x-oaiMeta: name: Vector store search result item AutoChunkingStrategyRequestParam: type: object title: Auto Chunking Strategy description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. additionalProperties: false properties: type: type: string description: Always `auto`. enum: - auto x-stainless-const: true required: - type VectorStoreSearchRequest: type: object additionalProperties: false properties: query: description: A query string for a search oneOf: - type: string - type: array items: type: string description: A list of queries to search for. minItems: 1 rewrite_query: description: Whether to rewrite the natural language query for vector search. type: boolean default: false max_num_results: description: The maximum number of results to return. This number should be between 1 and 50 inclusive. type: integer default: 10 minimum: 1 maximum: 50 filters: description: A filter to apply based on file attributes. oneOf: - $ref: '#/components/schemas/ComparisonFilter' - $ref: '#/components/schemas/CompoundFilter' ranking_options: description: Ranking options for search. type: object additionalProperties: false properties: ranker: description: Enable re-ranking; set to `none` to disable, which can help reduce latency. type: string enum: - none - auto - default-2024-11-15 default: auto score_threshold: type: number minimum: 0 maximum: 1 default: 0 required: - query x-oaiMeta: name: Vector store search request VectorStoreFileBatchObject: type: object title: Vector store file batch description: A batch of files attached to a vector store. properties: id: description: The identifier, which can be referenced in API endpoints. type: string object: description: The object type, which is always `vector_store.file_batch`. type: string enum: - vector_store.files_batch x-stainless-const: true created_at: description: The Unix timestamp (in seconds) for when the vector store files batch was created. type: integer format: unixtime vector_store_id: description: The ID of the [vector store](/docs/api-reference/vector-stores/object) that the [File](/docs/api-reference/files) is attached to. type: string status: description: The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. type: string enum: - in_progress - completed - cancelled - failed file_counts: type: object properties: in_progress: description: The number of files that are currently being processed. type: integer completed: description: The number of files that have been processed. type: integer failed: description: The number of files that have failed to process. type: integer cancelled: description: The number of files that where cancelled. type: integer total: description: The total number of files. type: integer required: - in_progress - completed - cancelled - failed - total required: - id - object - created_at - vector_store_id - status - file_counts x-oaiMeta: name: The vector store files batch object beta: true example: "{\n \"id\": \"vsfb_123\",\n \"object\": \"vector_store.files_batch\",\n \"created_at\": 1698107661,\n \"vector_store_id\": \"vs_abc123\",\n \"status\": \"completed\",\n \"file_counts\": {\n \"in_progress\": 0,\n \"completed\": 100,\n \"failed\": 0,\n \"cancelled\": 0,\n \"total\": 100\n }\n}\n" CreateVectorStoreFileBatchRequest: type: object additionalProperties: false properties: file_ids: description: A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`. type: array minItems: 1 maxItems: 2000 items: type: string files: description: A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`. type: array minItems: 1 maxItems: 2000 items: $ref: '#/components/schemas/CreateVectorStoreFileRequest' chunking_strategy: $ref: '#/components/schemas/ChunkingStrategyRequestParam' attributes: $ref: '#/components/schemas/VectorStoreFileAttributes' anyOf: - required: - file_ids - required: - files OtherChunkingStrategyResponseParam: type: object title: Other Chunking Strategy description: This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API. additionalProperties: false properties: type: type: string description: Always `other`. enum: - other x-stainless-const: true required: - type securitySchemes: ApiKeyAuth: type: http scheme: bearer x-oaiMeta: groups: - id: audio title: Audio description: 'Learn how to turn audio into text or text into audio. Related guide: [Speech to text](/docs/guides/speech-to-text) ' sections: - type: endpoint key: createSpeech path: createSpeech - type: endpoint key: createTranscription path: createTranscription - type: endpoint key: createTranslation path: createTranslation - id: chat title: Chat description: 'Given a list of messages comprising a conversation, the model will return a response. Related guide: [Chat Completions](/docs/guides/text-generation) ' sections: - type: endpoint key: createChatCompletion path: create - type: object key: CreateChatCompletionResponse path: object - type: object key: CreateChatCompletionStreamResponse path: streaming - id: embeddings title: Embeddings description: 'Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. Related guide: [Embeddings](/docs/guides/embeddings) ' sections: - type: endpoint key: createEmbedding path: create - type: object key: Embedding path: object - id: fine-tuning title: Fine-tuning description: 'Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: [Fine-tune models](/docs/guides/fine-tuning) ' sections: - type: endpoint key: createFineTuningJob path: create - type: endpoint key: listPaginatedFineTuningJobs path: list - type: endpoint key: listFineTuningEvents path: list-events - type: endpoint key: retrieveFineTuningJob path: retrieve - type: endpoint key: cancelFineTuningJob path: cancel - type: object key: FineTuningJob path: object - type: object key: FineTuningJobEvent path: event-object - id: files title: Files description: 'Files are used to upload documents that can be used with features like [Assistants](/docs/api-reference/assistants) and [Fine-tuning](/docs/api-reference/fine-tuning). ' sections: - type: endpoint key: createFile path: create - type: endpoint key: listFiles path: list - type: endpoint key: retrieveFile path: retrieve - type: endpoint key: deleteFile path: delete - type: endpoint key: downloadFile path: retrieve-contents - type: object key: OpenAIFile path: object - id: images title: Images description: 'Given a prompt and/or an input image, the model will generate a new image. Related guide: [Image generation](/docs/guides/images) ' sections: - type: endpoint key: createImage path: create - type: endpoint key: createImageEdit path: createEdit - type: endpoint key: createImageVariation path: createVariation - type: object key: Image path: object - id: models title: Models description: 'List and describe the various models available in the API. You can refer to the [Models](/docs/models) documentation to understand what models are available and the differences between them. ' sections: - type: endpoint key: listModels path: list - type: endpoint key: retrieveModel path: retrieve - type: endpoint key: deleteModel path: delete - type: object key: Model path: object - id: moderations title: Moderations description: 'Given a input text, outputs if the model classifies it as violating OpenAI''s content policy. Related guide: [Moderations](/docs/guides/moderation) ' sections: - type: endpoint key: createModeration path: create - type: object key: CreateModerationResponse path: object - id: assistants title: Assistants beta: true description: 'Build assistants that can call models and use tools to perform tasks. [Get started with the Assistants API](/docs/assistants) ' sections: - type: endpoint key: createAssistant path: createAssistant - type: endpoint key: createAssistantFile path: createAssistantFile - type: endpoint key: listAssistants path: listAssistants - type: endpoint key: listAssistantFiles path: listAssistantFiles - type: endpoint key: getAssistant path: getAssistant - type: endpoint key: getAssistantFile path: getAssistantFile - type: endpoint key: modifyAssistant path: modifyAssistant - type: endpoint key: deleteAssistant path: deleteAssistant - type: endpoint key: deleteAssistantFile path: deleteAssistantFile - type: object key: AssistantObject path: object - type: object key: AssistantFileObject path: file-object - id: threads title: Threads beta: true description: 'Create threads that assistants can interact with. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createThread path: createThread - type: endpoint key: getThread path: getThread - type: endpoint key: modifyThread path: modifyThread - type: endpoint key: deleteThread path: deleteThread - type: object key: ThreadObject path: object - id: messages title: Messages beta: true description: 'Create messages within threads Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createMessage path: createMessage - type: endpoint key: listMessages path: listMessages - type: endpoint key: listMessageFiles path: listMessageFiles - type: endpoint key: getMessage path: getMessage - type: endpoint key: getMessageFile path: getMessageFile - type: endpoint key: modifyMessage path: modifyMessage - type: object key: MessageObject path: object - type: object key: MessageFileObject path: file-object - id: runs title: Runs beta: true description: 'Represents an execution run on a thread. Related guide: [Assistants](/docs/assistants/overview) ' sections: - type: endpoint key: createRun path: createRun - type: endpoint key: createThreadAndRun path: createThreadAndRun - type: endpoint key: listRuns path: listRuns - type: endpoint key: listRunSteps path: listRunSteps - type: endpoint key: getRun path: getRun - type: endpoint key: getRunStep path: getRunStep - type: endpoint key: modifyRun path: modifyRun - type: endpoint key: submitToolOuputsToRun path: submitToolOutputs - type: endpoint key: cancelRun path: cancelRun - type: object key: RunObject path: object - type: object key: RunStepObject path: step-object - id: completions title: Completions legacy: true description: 'Given a prompt, the model will return one or more predicted completions along with the probabilities of alternative tokens at each position. Most developer should use our [Chat Completions API](/docs/guides/text-generation/text-generation-models) to leverage our best and newest models. Most models that support the legacy Completions endpoint [will be shut off on January 4th, 2024](/docs/deprecations/2023-07-06-gpt-and-embeddings). ' sections: - type: endpoint key: createCompletion path: create - type: object key: CreateCompletionResponse path: object