llama-stack-mirror/docs/docs/api/attach-a-file-to-a-vector-store.api.mdx
Alexey Rybak 0b6725ac7a api docs
2025-09-23 10:00:13 -07:00

68 lines
15 KiB
Text

---
id: attach-a-file-to-a-vector-store
title: "Attach a file to a vector store."
description: "Attach a file to a vector store."
sidebar_label: "Attach a file to a vector store."
hide_title: true
hide_table_of_contents: true
api: eJztWm1v1DgQ/itWPoHUbhcEB/Tb8iaqA1q15aQTRStv4t0YHDvYTtu9av/7zYyTbLLJtlvEh+spSMA268zrM2M/nt5EVrjcaCdcdHgTPR2P8b9EuNjK3Eujo8Nowv4SsTf2DP6K91KJ49l3eMCsyOFlob3UC+ZTwbj3PE5FwuawaBTtRbHRHr5HkTzPlYw5ijz47lDuTeRgccbxk1/mAjQZEgwv5tbkwnoZrJJJY43zFvTBmraRX7T8WQgmE7RnLoVlc2PJKjQmWu1VwnslzXmh4KvokhydOvR0RC9u6il9RxENZXuMqyu+dOyiK+IiQu0QGytnhQ8ebfrLk0SiAq5OWp4bLY7n0eHX+g1dKAXi6p9nxijBdfORLrKZsM0npaONJ9xavmw+KC1ZfVttOvynWO5fclVQeksXGHfOxJJ7yPWV9GkrznFa6B+gD0JgYcVi2UXUWfkNKxyiBRLlAB2+BhKKYlJ7w0iYgwh1IrEFK+Hbbo4Big4zzAtvWimvH/QaiGIaycXFFxFZjB8zwHPMKoej1WpbJudcObEHtfazkFYAnL8GA7/tRV56hZY2auxNKbCyYtJn4qSjn1UBJ/sCDhnhkALqRj0Jv2/4nEeVrQA2Hu0SwrC8DGL4oRHBvUpcBzNvjJ7LRWGphbCcW54JL6yr63xDVh0NsOx2n+mNqbkUVvF86s0PoZtFCjgUCyiohs/PxuNNdz9T1TEzZ0EA/MdKkWwm/JUQmvHkO4+hZVSoBm8zfj0N+p38R+yk/GVX+Sd+LbMiY3rTCPAyKNtjWeE8WFIb82Q8Zlwn7Nn41R/3Q25vvLa5shvCzyh3IcW/UEY1au6jrQexW8qJWlxc4W8GvWkNPygqUJpIFJR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rSaryqs/knXnZLYKHohqK6mEV1bhP2w4lRFWCUOMLh94EXnV0HHXuOiY0NoYkE2GFUPMW3cRB8vpiimi+Drfqm5QPkw6Pc+7T7q0T+L+FzqLGYEJ9F+UNal0nw9sCktMpzWqwihy/PKu+Nsky3Bz9lipHa3ai6m3/6kiWfnUv1EYPeiiN3v7oG0yTbxtD6b2egsbmBN8BosCI0Y5ja+IqnWtUCG6BVdb4dYPRMLAeBtbDZGeY7Pw3JzvDwHoYWA9tbWhr/7O2tvPA+j5+VQfwhkc4KOIysBYcEJ2bhrbqipysaRMImtT61CTIUQxdoxNVOYwOLp8cGJKKn5q0xh3cbLCc1QF1E4w1XWwERlRY5GOp9/nhwQHXy/0UFIhkXyme8X3ISvxjFJuMer8TwNCkX9KLbys4f/2G3yE/OV0zmXdrPlgzkXUzatGHbUfo6nCPTXRFvHwe9pEymh/RQnaGFrKzkj9Tb6GZnnUBE5dPehgPXje4FvHmzauApmSfcpojX0oQcqHZxh/OnKCZgtBJbqDYHdUkSJE4hbeBSyeIRuwEdg79wwWh3IoLHIcqIh6wP3WEz3A2ogQ4g4PaYNUnkwgVtgSEQsaJFZa8dgdC3ApFg23u8m6ZES+u/UGuuNQ0gbZ0KxMA+TXEO0AS8/BkY8CK8Dvs0u+ATIARog/F3NzMuBNfrFqt8DHgyiLs4CPdEs0QAQBCOI3g56SuwK3uPTotS+ox+xVG3+t6hVCNWxQxSvgJPgLB7LlkIDaaCp7AboC2h1VvgoX756ENVlI61B8JTXhjEsci97eu/dZoGCfHZ+eweFZeL2T0iymR5Vd4TwH/ksWGIkb7Fj27iRTXi4J+NyQKMvHPv7nGA3c=
sidebar_class_name: "post api-method"
info_path: docs/api/llama-stack-specification
custom_edit_url: null
---
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"Attach a file to a vector store."}
>
</Heading>
<MethodEndpoint
method={"post"}
path={"/v1/openai/v1/vector_stores/{vector_store_id}/files"}
context={"endpoint"}
>
</MethodEndpoint>
Attach a file to a vector store.
<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>
<ParamsDetails
parameters={[{"name":"vector_store_id","in":"path","description":"The ID of the vector store to attach the file to.","required":true,"schema":{"type":"string"}}]}
>
</ParamsDetails>
<RequestSchema
title={"Body"}
body={{"content":{"application/json":{"schema":{"type":"object","properties":{"file_id":{"type":"string","description":"The ID of the file to attach to the vector store."},"attributes":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]},"description":"The key-value attributes stored with the file, which can be used for filtering."},"chunking_strategy":{"description":"The chunking strategy to use for the file.","oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"auto","default":"auto","description":"Strategy type, always \"auto\" for automatic chunking"}},"additionalProperties":false,"required":["type"],"title":"VectorStoreChunkingStrategyAuto","description":"Automatic chunking strategy for vector store files."},{"type":"object","properties":{"type":{"type":"string","const":"static","default":"static","description":"Strategy type, always \"static\" for static chunking"},"static":{"description":"Configuration parameters for the static chunking strategy","type":"object","properties":{"chunk_overlap_tokens":{"type":"integer","default":400,"description":"Number of tokens to overlap between adjacent chunks"},"max_chunk_size_tokens":{"type":"integer","default":800,"description":"Maximum number of tokens per chunk, must be between 100 and 4096"}},"additionalProperties":false,"required":["chunk_overlap_tokens","max_chunk_size_tokens"],"title":"VectorStoreChunkingStrategyStaticConfig"}},"additionalProperties":false,"required":["type","static"],"title":"VectorStoreChunkingStrategyStatic","description":"Static chunking strategy with configurable parameters."}],"discriminator":{"propertyName":"type","mapping":{"auto":{"type":"object","properties":{"type":{"type":"string","const":"auto","default":"auto","description":"Strategy type, always \"auto\" for automatic chunking"}},"additionalProperties":false,"required":["type"],"title":"VectorStoreChunkingStrategyAuto","description":"Automatic chunking strategy for vector store files."},"static":{"type":"object","properties":{"type":{"type":"string","const":"static","default":"static","description":"Strategy type, always \"static\" for static chunking"},"static":{"description":"Configuration parameters for the static chunking strategy","type":"object","properties":{"chunk_overlap_tokens":{"type":"integer","default":400,"description":"Number of tokens to overlap between adjacent chunks"},"max_chunk_size_tokens":{"type":"integer","default":800,"description":"Maximum number of tokens per chunk, must be between 100 and 4096"}},"additionalProperties":false,"required":["chunk_overlap_tokens","max_chunk_size_tokens"],"title":"VectorStoreChunkingStrategyStaticConfig"}},"additionalProperties":false,"required":["type","static"],"title":"VectorStoreChunkingStrategyStatic","description":"Static chunking strategy with configurable parameters."}}},"title":"VectorStoreChunkingStrategy"}},"additionalProperties":false,"required":["file_id"],"title":"OpenaiAttachFileToVectorStoreRequest"}}},"required":true}}
>
</RequestSchema>
<StatusCodes
id={undefined}
label={undefined}
responses={{"200":{"description":"A VectorStoreFileObject representing the attached file.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the file"},"object":{"type":"string","default":"vector_store.file","description":"Object type identifier, always \"vector_store.file\""},"attributes":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]},"description":"Key-value attributes associated with the file"},"chunking_strategy":{"description":"Strategy used for splitting the file into chunks","oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"auto","default":"auto","description":"Strategy type, always \"auto\" for automatic chunking"}},"additionalProperties":false,"required":["type"],"title":"VectorStoreChunkingStrategyAuto","description":"Automatic chunking strategy for vector store files."},{"type":"object","properties":{"type":{"type":"string","const":"static","default":"static","description":"Strategy type, always \"static\" for static chunking"},"static":{"description":"Configuration parameters for the static chunking strategy","type":"object","properties":{"chunk_overlap_tokens":{"type":"integer","default":400,"description":"Number of tokens to overlap between adjacent chunks"},"max_chunk_size_tokens":{"type":"integer","default":800,"description":"Maximum number of tokens per chunk, must be between 100 and 4096"}},"additionalProperties":false,"required":["chunk_overlap_tokens","max_chunk_size_tokens"],"title":"VectorStoreChunkingStrategyStaticConfig"}},"additionalProperties":false,"required":["type","static"],"title":"VectorStoreChunkingStrategyStatic","description":"Static chunking strategy with configurable parameters."}],"discriminator":{"propertyName":"type","mapping":{"auto":{"type":"object","properties":{"type":{"type":"string","const":"auto","default":"auto","description":"Strategy type, always \"auto\" for automatic chunking"}},"additionalProperties":false,"required":["type"],"title":"VectorStoreChunkingStrategyAuto","description":"Automatic chunking strategy for vector store files."},"static":{"type":"object","properties":{"type":{"type":"string","const":"static","default":"static","description":"Strategy type, always \"static\" for static chunking"},"static":{"description":"Configuration parameters for the static chunking strategy","type":"object","properties":{"chunk_overlap_tokens":{"type":"integer","default":400,"description":"Number of tokens to overlap between adjacent chunks"},"max_chunk_size_tokens":{"type":"integer","default":800,"description":"Maximum number of tokens per chunk, must be between 100 and 4096"}},"additionalProperties":false,"required":["chunk_overlap_tokens","max_chunk_size_tokens"],"title":"VectorStoreChunkingStrategyStaticConfig"}},"additionalProperties":false,"required":["type","static"],"title":"VectorStoreChunkingStrategyStatic","description":"Static chunking strategy with configurable parameters."}}},"title":"VectorStoreChunkingStrategy"},"created_at":{"type":"integer","description":"Timestamp when the file was added to the vector store"},"last_error":{"description":"(Optional) Error information if file processing failed","type":"object","properties":{"code":{"oneOf":[{"type":"string","const":"server_error"},{"type":"string","const":"rate_limit_exceeded"}],"description":"Error code indicating the type of failure"},"message":{"type":"string","description":"Human-readable error message describing the failure"}},"additionalProperties":false,"required":["code","message"],"title":"VectorStoreFileLastError"},"status":{"description":"Current processing status of the file","oneOf":[{"type":"string","const":"completed"},{"type":"string","const":"in_progress"},{"type":"string","const":"cancelled"},{"type":"string","const":"failed"}],"title":"VectorStoreFileStatus"},"usage_bytes":{"type":"integer","default":0,"description":"Storage space used by this file in bytes"},"vector_store_id":{"type":"string","description":"ID of the vector store containing this file"}},"additionalProperties":false,"required":["id","object","attributes","chunking_strategy","created_at","status","usage_bytes","vector_store_id"],"title":"VectorStoreFileObject","description":"OpenAI Vector Store File object."}}}},"400":{"description":"The request was invalid or malformed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":400,"title":"Bad Request","detail":"The request was invalid or malformed"}}}},"429":{"description":"The client has sent too many requests in a given amount of time","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":429,"title":"Too Many Requests","detail":"You have exceeded the rate limit. Please try again later."}}}},"500":{"description":"The server encountered an unexpected error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":500,"title":"Internal Server Error","detail":"An unexpected error occurred. Our team has been notified."}}}},"default":{"description":"An unexpected error occurred","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":0,"title":"Error","detail":"An unexpected error occurred"}}}}}}
>
</StatusCodes>