Create a vector store

Create a vector store with or without files.

Request

POST

https://ai.api.cloud.yandex.net/v1/vector_stores
        

Body

application/json
{
          "file_ids": [
            "example"
          ],
          "name": "example",
          "description": "example",
          "expires_after": {
            "anchor": "last_active_at",
            "days": 1
          },
          "chunking_strategy": {
            "type": "auto"
          },
          "metadata": {}
        }
        

Name

Description

chunking_strategy

Type: object

One of 2 types
  • Auto Chunking Strategy

    Type: AutoChunkingStrategyRequestParam

    The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

    Example
    {
              "type": "auto"
            }
            
  • Static Chunking Strategy

    Type: StaticChunkingStrategyRequestParam

    Customize your own chunking strategy by setting chunk size and chunk overlap.

    Example
    {
              "type": "static",
              "static": {
                "max_chunk_size_tokens": 100,
                "chunk_overlap_tokens": 0
              }
            }
            

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.

Example
{
          "type": "auto"
        }
        

description

Type: string

A description for the vector store. Can be used to describe the vector store's purpose.

Example: example

expires_after

Type: VectorStoreExpirationAfter

The expiration policy for a vector store.

Example
{
          "anchor": "last_active_at",
          "days": 1
        }
        

file_ids

Type: string[]

A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.

Max items: 500

Example
[
          "example"
        ]
        

metadata

Type: Metadata

Example
{}
        

name

Type: string

The name of the vector store.

Example: example

VectorStoreExpirationAfter

The expiration policy for a vector store.

Name

Description

anchor

Type: string

Anchor timestamp after which the expiration policy applies. Supported anchors: last_active_at.

Const: last_active_at

Example: example

days

Type: integer

The number of days after the anchor time that the vector store will expire.

Min value: 1

Max value: 365

Example
{
          "anchor": "last_active_at",
          "days": 1
        }
        

AutoChunkingStrategyRequestParam

The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400.

Name

Description

type

Type: string

Always auto.

Const: auto

Example: example

Example
{
          "type": "auto"
        }
        

StaticChunkingStrategy

Name

Description

chunk_overlap_tokens

Type: integer

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.

max_chunk_size_tokens

Type: integer

The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096.

Min value: 100

Max value: 4096

Example
{
          "max_chunk_size_tokens": 100,
          "chunk_overlap_tokens": 0
        }
        

StaticChunkingStrategyRequestParam

Customize your own chunking strategy by setting chunk size and chunk overlap.

Name

Description

static

Type: StaticChunkingStrategy

Example
{
          "max_chunk_size_tokens": 100,
          "chunk_overlap_tokens": 0
        }
        

type

Type: string

Always static.

Const: static

Example: example

Example
{
          "type": "static",
          "static": {
            "max_chunk_size_tokens": 100,
            "chunk_overlap_tokens": 0
          }
        }
        

Metadata

Any of 2 types
  • Type: object

    [additional]

    Type: string

    Example: example

    Set of 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.

    Example
    {}
            
  • Type: null

    Example: null

Example
{}
        

Responses

200 OK

OK

Body

application/json
{
          "id": "example",
          "object": "vector_store",
          "created_at": 0,
          "name": "example",
          "usage_bytes": 0,
          "file_counts": {
            "in_progress": 0,
            "completed": 0,
            "failed": 0,
            "cancelled": 0,
            "total": 0
          },
          "status": "expired",
          "expires_after": {
            "anchor": "last_active_at",
            "days": 1
          },
          "expires_at": 0,
          "last_active_at": 0,
          "metadata": {}
        }
        

Name

Description

created_at

Type: integer

The Unix timestamp (in seconds) for when the vector store was created.

file_counts

Type: object

cancelled

Type: integer

The number of files that were cancelled.

completed

Type: integer

The number of files that have been successfully processed.

failed

Type: integer

The number of files that have failed to process.

in_progress

Type: integer

The number of files that are currently being processed.

total

Type: integer

The total number of files.

Example
{
          "in_progress": 0,
          "completed": 0,
          "failed": 0,
          "cancelled": 0,
          "total": 0
        }
        

id

Type: string

The identifier, which can be referenced in API endpoints.

Example: example

last_active_at

Any of 2 types
  • Type: integer

    The Unix timestamp (in seconds) for when the vector store was last active.

  • Type: null

    Example: null

Example: 0

metadata

Type: Metadata

Example
{}
        

name

Type: string

The name of the vector store.

Example: example

object

Type: string

The object type, which is always vector_store.

Const: vector_store

Example: example

status

Type: string

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.

Enum: expired, in_progress, completed

usage_bytes

Type: integer

The total number of bytes used by the files in the vector store.

expires_after

Type: VectorStoreExpirationAfter

The expiration policy for a vector store.

Example
{
          "anchor": "last_active_at",
          "days": 1
        }
        

expires_at

Any of 2 types
  • Type: integer

    The Unix timestamp (in seconds) for when the vector store will expire.

  • Type: null

    Example: null

Example: 0

Предыдущая
Следующая