glopenai/vector_store

Types

File attribute value: untagged String / Number / Boolean.

pub type AttributeValue {
  AttributeString(value: String)
  AttributeNumber(value: Int)
  AttributeBoolean(value: Bool)
}

Constructors

  • AttributeString(value: String)
  • AttributeNumber(value: Int)
  • AttributeBoolean(value: Bool)

Tagged: auto or static with a nested static config.

pub type ChunkingStrategyRequestParam {
  AutoChunking
  StaticChunking(config: StaticChunkingStrategy)
}

Constructors

Returned on VectorStoreFileObject.chunking_strategy. Includes an Other variant for files indexed before the strategy concept existed.

pub type ChunkingStrategyResponse {
  OtherChunking
  StaticChunkingResponse(config: StaticChunkingStrategy)
}

Constructors

pub type ComparisonFilterRecord {
  ComparisonFilterRecord(
    comparison_type: ComparisonType,
    key: String,
    value: dynamic.Dynamic,
  )
}

Constructors

  • ComparisonFilterRecord(
      comparison_type: ComparisonType,
      key: String,
      value: dynamic.Dynamic,
    )

    Arguments

    value

    Value to compare against. Carry as Dynamic so callers can pass a string, number, or boolean.

pub type ComparisonType {
  Equals
  NotEquals
  GreaterThan
  GreaterThanOrEqual
  LessThan
  LessThanOrEqual
  In
  NotIn
}

Constructors

  • Equals
  • NotEquals
  • GreaterThan
  • GreaterThanOrEqual
  • LessThan
  • LessThanOrEqual
  • In
  • NotIn
pub type CompoundFilterRecord {
  CompoundFilterRecord(
    compound_type: CompoundType,
    filters: List(Filter),
  )
}

Constructors

pub type CompoundType {
  And
  Or
}

Constructors

  • And
  • Or
pub type CreateVectorStoreFileBatchRequest {
  CreateVectorStoreFileBatchRequest(
    file_ids: option.Option(List(String)),
    files: option.Option(List(CreateVectorStoreFileRequest)),
    chunking_strategy: option.Option(ChunkingStrategyRequestParam),
    attributes: option.Option(dict.Dict(String, AttributeValue)),
  )
}

Constructors

pub type CreateVectorStoreFileRequest {
  CreateVectorStoreFileRequest(
    file_id: String,
    chunking_strategy: option.Option(ChunkingStrategyRequestParam),
    attributes: option.Option(dict.Dict(String, AttributeValue)),
  )
}

Constructors

pub type CreateVectorStoreRequest {
  CreateVectorStoreRequest(
    file_ids: option.Option(List(String)),
    name: option.Option(String),
    description: option.Option(String),
    expires_after: option.Option(VectorStoreExpirationAfter),
    chunking_strategy: option.Option(ChunkingStrategyRequestParam),
    metadata: option.Option(dict.Dict(String, String)),
  )
}

Constructors

pub type DeleteVectorStoreFileResponse {
  DeleteVectorStoreFileResponse(
    id: String,
    object: String,
    deleted: Bool,
  )
}

Constructors

  • DeleteVectorStoreFileResponse(
      id: String,
      object: String,
      deleted: Bool,
    )
pub type DeleteVectorStoreResponse {
  DeleteVectorStoreResponse(
    id: String,
    object: String,
    deleted: Bool,
  )
}

Constructors

  • DeleteVectorStoreResponse(
      id: String,
      object: String,
      deleted: Bool,
    )

A vector-store search filter. Untagged in JSON: a ComparisonFilter or a CompoundFilter.

pub type Filter {
  ComparisonFilter(filter: ComparisonFilterRecord)
  CompoundFilter(filter: CompoundFilterRecord)
}

Constructors

File status filter used by both ListVectorStoreFilesQuery and ListFilesInVectorStoreBatchQuery.

pub type ListFilesFilter {
  FilterInProgress
  FilterCompleted
  FilterFailed
  FilterCancelled
}

Constructors

  • FilterInProgress
  • FilterCompleted
  • FilterFailed
  • FilterCancelled
pub type ListFilesInVectorStoreBatchQuery {
  ListFilesInVectorStoreBatchQuery(
    limit: option.Option(Int),
    order: option.Option(ListOrder),
    after: option.Option(String),
    before: option.Option(String),
    filter: option.Option(ListFilesFilter),
  )
}

Constructors

pub type ListOrder {
  Asc
  Desc
}

Constructors

  • Asc
  • Desc
pub type ListVectorStoreFilesQuery {
  ListVectorStoreFilesQuery(
    limit: option.Option(Int),
    order: option.Option(ListOrder),
    after: option.Option(String),
    before: option.Option(String),
    filter: option.Option(ListFilesFilter),
  )
}

Constructors

pub type ListVectorStoreFilesResponse {
  ListVectorStoreFilesResponse(
    object: String,
    data: List(VectorStoreFileObject),
    first_id: option.Option(String),
    last_id: option.Option(String),
    has_more: Bool,
  )
}

Constructors

pub type ListVectorStoresQuery {
  ListVectorStoresQuery(
    limit: option.Option(Int),
    order: option.Option(ListOrder),
    after: option.Option(String),
    before: option.Option(String),
  )
}

Constructors

pub type ListVectorStoresResponse {
  ListVectorStoresResponse(
    object: String,
    data: List(VectorStoreObject),
    first_id: option.Option(String),
    last_id: option.Option(String),
    has_more: Bool,
  )
}

Constructors

pub type Ranker {
  RankerNone
  RankerAuto
  RankerDefault20241115
}

Constructors

  • RankerNone
  • RankerAuto
  • RankerDefault20241115
pub type RankingOptions {
  RankingOptions(
    ranker: option.Option(Ranker),
    score_threshold: option.Option(Float),
  )
}

Constructors

Static chunking strategy. Mirrors Rust’s StaticChunkingStrategy.

pub type StaticChunkingStrategy {
  StaticChunkingStrategy(
    max_chunk_size_tokens: Int,
    chunk_overlap_tokens: Int,
  )
}

Constructors

  • StaticChunkingStrategy(
      max_chunk_size_tokens: Int,
      chunk_overlap_tokens: Int,
    )
pub type UpdateVectorStoreFileAttributesRequest {
  UpdateVectorStoreFileAttributesRequest(
    attributes: dict.Dict(String, AttributeValue),
  )
}

Constructors

pub type UpdateVectorStoreRequest {
  UpdateVectorStoreRequest(
    name: option.Option(String),
    expires_after: option.Option(VectorStoreExpirationAfter),
    metadata: option.Option(dict.Dict(String, String)),
  )
}

Constructors

Expiration policy for vector stores or chat sessions.

pub type VectorStoreExpirationAfter {
  VectorStoreExpirationAfter(anchor: String, days: Int)
}

Constructors

  • VectorStoreExpirationAfter(anchor: String, days: Int)

VectorStoreFileAttributes is a transparent newtype around Dict in Rust; in Gleam we just use Dict(String, AttributeValue) directly.

pub type VectorStoreFileAttributes =
  dict.Dict(String, AttributeValue)
pub type VectorStoreFileBatchCounts {
  VectorStoreFileBatchCounts(
    in_progress: Int,
    completed: Int,
    failed: Int,
    cancelled: Int,
    total: Int,
  )
}

Constructors

  • VectorStoreFileBatchCounts(
      in_progress: Int,
      completed: Int,
      failed: Int,
      cancelled: Int,
      total: Int,
    )
pub type VectorStoreFileBatchObject {
  VectorStoreFileBatchObject(
    id: String,
    object: String,
    created_at: Int,
    vector_store_id: String,
    status: VectorStoreFileBatchStatus,
    file_counts: VectorStoreFileBatchCounts,
  )
}

Constructors

pub type VectorStoreFileBatchStatus {
  BatchInProgress
  BatchCompleted
  BatchCancelled
  BatchFailed
}

Constructors

  • BatchInProgress
  • BatchCompleted
  • BatchCancelled
  • BatchFailed
pub type VectorStoreFileContentObject {
  VectorStoreFileContentObject(
    content_type: String,
    text: String,
  )
}

Constructors

  • VectorStoreFileContentObject(content_type: String, text: String)
pub type VectorStoreFileContentResponse {
  VectorStoreFileContentResponse(
    object: String,
    data: List(VectorStoreFileContentObject),
    has_more: Bool,
    next_page: option.Option(String),
  )
}

Constructors

pub type VectorStoreFileCounts {
  VectorStoreFileCounts(
    in_progress: Int,
    completed: Int,
    failed: Int,
    cancelled: Int,
    total: Int,
  )
}

Constructors

  • VectorStoreFileCounts(
      in_progress: Int,
      completed: Int,
      failed: Int,
      cancelled: Int,
      total: Int,
    )
pub type VectorStoreFileError {
  VectorStoreFileError(
    code: VectorStoreFileErrorCode,
    message: String,
  )
}

Constructors

pub type VectorStoreFileErrorCode {
  ServerError
  UnsupportedFile
  InvalidFile
}

Constructors

  • ServerError
  • UnsupportedFile
  • InvalidFile
pub type VectorStoreFileObject {
  VectorStoreFileObject(
    id: String,
    object: String,
    usage_bytes: Int,
    created_at: Int,
    vector_store_id: String,
    status: VectorStoreFileStatus,
    last_error: option.Option(VectorStoreFileError),
    chunking_strategy: option.Option(ChunkingStrategyResponse),
    attributes: option.Option(dict.Dict(String, AttributeValue)),
  )
}

Constructors

pub type VectorStoreFileStatus {
  FileInProgress
  FileCompleted
  FileCancelled
  FileFailed
}

Constructors

  • FileInProgress
  • FileCompleted
  • FileCancelled
  • FileFailed
pub type VectorStoreObject {
  VectorStoreObject(
    id: String,
    object: String,
    created_at: Int,
    name: option.Option(String),
    usage_bytes: Int,
    file_counts: VectorStoreFileCounts,
    status: VectorStoreStatus,
    expires_after: option.Option(VectorStoreExpirationAfter),
    expires_at: option.Option(Int),
    last_active_at: option.Option(Int),
    metadata: option.Option(dict.Dict(String, String)),
  )
}

Constructors

Untagged: Text(String) or Array(List(String)).

pub type VectorStoreSearchQuery {
  TextQuery(query: String)
  ArrayQuery(queries: List(String))
}

Constructors

  • TextQuery(query: String)
  • ArrayQuery(queries: List(String))
pub type VectorStoreSearchRequest {
  VectorStoreSearchRequest(
    query: VectorStoreSearchQuery,
    rewrite_query: option.Option(Bool),
    max_num_results: option.Option(Int),
    filters: option.Option(Filter),
    ranking_options: option.Option(RankingOptions),
  )
}

Constructors

pub type VectorStoreSearchResultContentObject {
  VectorStoreSearchResultContentObject(
    content_type: String,
    text: String,
  )
}

Constructors

  • VectorStoreSearchResultContentObject(
      content_type: String,
      text: String,
    )
pub type VectorStoreSearchResultItem {
  VectorStoreSearchResultItem(
    file_id: String,
    filename: String,
    score: Float,
    attributes: dict.Dict(String, AttributeValue),
    content: List(VectorStoreSearchResultContentObject),
  )
}

Constructors

pub type VectorStoreSearchResultsPage {
  VectorStoreSearchResultsPage(
    object: String,
    search_query: List(String),
    data: List(VectorStoreSearchResultItem),
    has_more: Bool,
    next_page: option.Option(String),
  )
}

Constructors

pub type VectorStoreStatus {
  StoreExpired
  StoreInProgress
  StoreCompleted
}

Constructors

  • StoreExpired
  • StoreInProgress
  • StoreCompleted

Values

pub fn attribute_value_to_json(
  value: AttributeValue,
) -> json.Json
pub fn batch_cancel_request(
  config: config.Config,
  vector_store_id: String,
  batch_id: String,
) -> request.Request(String)
pub fn batch_cancel_response(
  response: response.Response(String),
) -> Result(VectorStoreFileBatchObject, error.GlopenaiError)
pub fn batch_create_request(
  config: config.Config,
  vector_store_id: String,
  request: CreateVectorStoreFileBatchRequest,
) -> request.Request(String)
pub fn batch_create_response(
  response: response.Response(String),
) -> Result(VectorStoreFileBatchObject, error.GlopenaiError)
pub fn batch_list_files_request(
  config: config.Config,
  vector_store_id: String,
  batch_id: String,
) -> request.Request(String)
pub fn batch_list_files_request_with_query(
  config: config.Config,
  vector_store_id: String,
  batch_id: String,
  query: ListFilesInVectorStoreBatchQuery,
) -> request.Request(String)
pub fn batch_list_files_response(
  response: response.Response(String),
) -> Result(ListVectorStoreFilesResponse, error.GlopenaiError)
pub fn batch_retrieve_request(
  config: config.Config,
  vector_store_id: String,
  batch_id: String,
) -> request.Request(String)
pub fn batch_retrieve_response(
  response: response.Response(String),
) -> Result(VectorStoreFileBatchObject, error.GlopenaiError)
pub fn batch_with_file_ids(
  request: CreateVectorStoreFileBatchRequest,
  file_ids: List(String),
) -> CreateVectorStoreFileBatchRequest
pub fn chunking_strategy_request_param_to_json(
  strategy: ChunkingStrategyRequestParam,
) -> json.Json
pub fn chunking_strategy_response_to_json(
  strategy: ChunkingStrategyResponse,
) -> json.Json
pub fn comparison_type_to_json(
  comparison_type: ComparisonType,
) -> json.Json
pub fn compound_type_decoder() -> decode.Decoder(CompoundType)
pub fn compound_type_to_json(
  compound_type: CompoundType,
) -> json.Json
pub fn create_request(
  config: config.Config,
  request: CreateVectorStoreRequest,
) -> request.Request(String)
pub fn create_response(
  response: response.Response(String),
) -> Result(VectorStoreObject, error.GlopenaiError)
pub fn create_vector_store_file_batch_request_to_json(
  request: CreateVectorStoreFileBatchRequest,
) -> json.Json
pub fn create_vector_store_file_request_to_json(
  request: CreateVectorStoreFileRequest,
) -> json.Json
pub fn create_vector_store_request_to_json(
  request: CreateVectorStoreRequest,
) -> json.Json
pub fn delete_request(
  config: config.Config,
  vector_store_id: String,
) -> request.Request(String)
pub fn delete_response(
  response: response.Response(String),
) -> Result(DeleteVectorStoreResponse, error.GlopenaiError)
pub fn empty_list_files_in_vector_store_batch_query() -> ListFilesInVectorStoreBatchQuery
pub fn empty_list_vector_store_files_query() -> ListVectorStoreFilesQuery
pub fn empty_list_vector_stores_query() -> ListVectorStoresQuery
pub fn file_content_request(
  config: config.Config,
  vector_store_id: String,
  file_id: String,
) -> request.Request(String)
pub fn file_content_response(
  response: response.Response(String),
) -> Result(VectorStoreFileContentResponse, error.GlopenaiError)
pub fn file_create_request(
  config: config.Config,
  vector_store_id: String,
  request: CreateVectorStoreFileRequest,
) -> request.Request(String)
pub fn file_create_response(
  response: response.Response(String),
) -> Result(VectorStoreFileObject, error.GlopenaiError)
pub fn file_delete_request(
  config: config.Config,
  vector_store_id: String,
  file_id: String,
) -> request.Request(String)
pub fn file_delete_response(
  response: response.Response(String),
) -> Result(DeleteVectorStoreFileResponse, error.GlopenaiError)
pub fn file_list_request(
  config: config.Config,
  vector_store_id: String,
) -> request.Request(String)
pub fn file_list_request_with_query(
  config: config.Config,
  vector_store_id: String,
  query: ListVectorStoreFilesQuery,
) -> request.Request(String)
pub fn file_list_response(
  response: response.Response(String),
) -> Result(ListVectorStoreFilesResponse, error.GlopenaiError)
pub fn file_retrieve_request(
  config: config.Config,
  vector_store_id: String,
  file_id: String,
) -> request.Request(String)
pub fn file_retrieve_response(
  response: response.Response(String),
) -> Result(VectorStoreFileObject, error.GlopenaiError)
pub fn file_update_request(
  config: config.Config,
  vector_store_id: String,
  file_id: String,
  request: UpdateVectorStoreFileAttributesRequest,
) -> request.Request(String)
pub fn file_update_response(
  response: response.Response(String),
) -> Result(VectorStoreFileObject, error.GlopenaiError)
pub fn filter_decoder() -> decode.Decoder(Filter)
pub fn filter_to_json(filter: Filter) -> json.Json
pub fn list_request(
  config: config.Config,
) -> request.Request(String)
pub fn list_request_with_query(
  config: config.Config,
  query: ListVectorStoresQuery,
) -> request.Request(String)
pub fn list_response(
  response: response.Response(String),
) -> Result(ListVectorStoresResponse, error.GlopenaiError)
pub fn new_create_file_request(
  file_id: String,
) -> CreateVectorStoreFileRequest
pub fn ranker_decoder() -> decode.Decoder(Ranker)
pub fn ranker_to_json(ranker: Ranker) -> json.Json
pub fn ranking_options_to_json(
  options: RankingOptions,
) -> json.Json
pub fn retrieve_request(
  config: config.Config,
  vector_store_id: String,
) -> request.Request(String)
pub fn retrieve_response(
  response: response.Response(String),
) -> Result(VectorStoreObject, error.GlopenaiError)
pub fn search_request(
  config: config.Config,
  vector_store_id: String,
  request: VectorStoreSearchRequest,
) -> request.Request(String)
pub fn search_response(
  response: response.Response(String),
) -> Result(VectorStoreSearchResultsPage, error.GlopenaiError)
pub fn search_with_filters(
  request: VectorStoreSearchRequest,
  filters: Filter,
) -> VectorStoreSearchRequest
pub fn search_with_max_num_results(
  request: VectorStoreSearchRequest,
  max_num_results: Int,
) -> VectorStoreSearchRequest
pub fn search_with_ranking_options(
  request: VectorStoreSearchRequest,
  ranking_options: RankingOptions,
) -> VectorStoreSearchRequest
pub fn search_with_rewrite_query(
  request: VectorStoreSearchRequest,
  rewrite_query: Bool,
) -> VectorStoreSearchRequest
pub fn static_chunking_strategy_decoder() -> decode.Decoder(
  StaticChunkingStrategy,
)
pub fn static_chunking_strategy_to_json(
  strategy: StaticChunkingStrategy,
) -> json.Json
pub fn update_request(
  config: config.Config,
  vector_store_id: String,
  request: UpdateVectorStoreRequest,
) -> request.Request(String)
pub fn update_response(
  response: response.Response(String),
) -> Result(VectorStoreObject, error.GlopenaiError)
pub fn update_vector_store_file_attributes_request_to_json(
  request: UpdateVectorStoreFileAttributesRequest,
) -> json.Json
pub fn update_vector_store_request_to_json(
  request: UpdateVectorStoreRequest,
) -> json.Json
pub fn update_with_metadata(
  request: UpdateVectorStoreRequest,
  metadata: dict.Dict(String, String),
) -> UpdateVectorStoreRequest
pub fn update_with_name(
  request: UpdateVectorStoreRequest,
  name: String,
) -> UpdateVectorStoreRequest
pub fn vector_store_expiration_after_to_json(
  expiration: VectorStoreExpirationAfter,
) -> json.Json
pub fn vector_store_file_attributes_decoder() -> decode.Decoder(
  dict.Dict(String, AttributeValue),
)
pub fn vector_store_file_attributes_to_json(
  attributes: dict.Dict(String, AttributeValue),
) -> json.Json
pub fn vector_store_file_counts_decoder() -> decode.Decoder(
  VectorStoreFileCounts,
)
pub fn vector_store_file_counts_to_json(
  counts: VectorStoreFileCounts,
) -> json.Json
pub fn vector_store_file_error_code_decoder() -> decode.Decoder(
  VectorStoreFileErrorCode,
)
pub fn vector_store_file_object_decoder() -> decode.Decoder(
  VectorStoreFileObject,
)
pub fn vector_store_file_status_decoder() -> decode.Decoder(
  VectorStoreFileStatus,
)
pub fn vector_store_file_status_to_json(
  status: VectorStoreFileStatus,
) -> json.Json
pub fn vector_store_object_decoder() -> decode.Decoder(
  VectorStoreObject,
)
pub fn vector_store_search_query_to_json(
  query: VectorStoreSearchQuery,
) -> json.Json
pub fn vector_store_search_request_to_json(
  request: VectorStoreSearchRequest,
) -> json.Json
pub fn vector_store_status_decoder() -> decode.Decoder(
  VectorStoreStatus,
)
pub fn vector_store_status_to_json(
  status: VectorStoreStatus,
) -> json.Json
pub fn with_description(
  request: CreateVectorStoreRequest,
  description: String,
) -> CreateVectorStoreRequest
pub fn with_file_ids(
  request: CreateVectorStoreRequest,
  file_ids: List(String),
) -> CreateVectorStoreRequest
pub fn with_metadata(
  request: CreateVectorStoreRequest,
  metadata: dict.Dict(String, String),
) -> CreateVectorStoreRequest
pub fn with_name(
  request: CreateVectorStoreRequest,
  name: String,
) -> CreateVectorStoreRequest
Search Document