ExBifrost.Api.AnthropicIntegration (ex_bifrost v0.1.0)

Copy Markdown View Source

API calls for all endpoints tagged AnthropicIntegration.

Summary

Functions

Cancel batch job (Anthropic format) Cancels a batch processing job.

Count tokens (Anthropic format) Counts the number of tokens in a message request.

Create batch job (Anthropic format) Creates a batch processing job using Anthropic format. Use x-model-provider header to specify the provider.

Create completion (Anthropic legacy format) Creates a text completion using Anthropic's legacy Complete API. Supports streaming via SSE.

Create message (Anthropic format) Creates a message using Anthropic Messages API format. Supports streaming via SSE. Async inference: Send x-bf-async: true to submit the request as a background job and receive a job ID immediately. Poll with x-bf-async-id: <job-id> to retrieve the result. When the job is still processing, the response will have an empty content array. When completed, content will contain the full result. See Async Inference for details.

Create message (Anthropic format) - wildcard Handles extended messages API paths.

Delete file (Anthropic format) Deletes an uploaded file.

Get batch results (Anthropic format) Retrieves results of a completed batch job.

Get file content (Anthropic format) Retrieves file content. Returns raw binary file data when Accept header is set to application/octet-stream, or file metadata as JSON when Accept header is set to application/json.

List batch jobs (Anthropic format) Lists batch processing jobs.

List files (Anthropic format) Lists uploaded files.

List models (Anthropic format) Lists available models in Anthropic format.

Retrieve batch job (Anthropic format) Retrieves details of a batch processing job.

Upload file (Anthropic format) Uploads a file. Use x-model-provider header to specify the provider.

Functions

anthropic_cancel_batch(connection, batch_id, opts \\ [])

Cancel batch job (Anthropic format) Cancels a batch processing job.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • batch_id (String.t): Batch job ID to cancel
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider for the batch

Returns

  • {:ok, ExBifrost.Model.AnthropicListBatches200ResponseDataInner.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_count_tokens(connection, anthropic_message_request, opts \\ [])

Count tokens (Anthropic format) Counts the number of tokens in a message request.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • anthropic_message_request (AnthropicMessageRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.AnthropicCountTokens200Response.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_create_batch(connection, anthropic_create_batch_request, opts \\ [])

Create batch job (Anthropic format) Creates a batch processing job using Anthropic format. Use x-model-provider header to specify the provider.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • anthropic_create_batch_request (AnthropicCreateBatchRequest):
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider to use (defaults to anthropic)

Returns

  • {:ok, ExBifrost.Model.AnthropicListBatches200ResponseDataInner.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_create_complete(connection, anthropic_text_request, opts \\ [])

Create completion (Anthropic legacy format) Creates a text completion using Anthropic's legacy Complete API. Supports streaming via SSE.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • anthropic_text_request (AnthropicTextRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.AnthropicCreateComplete200Response.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_create_message(connection, anthropic_message_request, opts \\ [])

Create message (Anthropic format) Creates a message using Anthropic Messages API format. Supports streaming via SSE. Async inference: Send x-bf-async: true to submit the request as a background job and receive a job ID immediately. Poll with x-bf-async-id: <job-id> to retrieve the result. When the job is still processing, the response will have an empty content array. When completed, content will contain the full result. See Async Inference for details.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • anthropic_message_request (AnthropicMessageRequest):
  • opts (keyword): Optional parameters
    • :"x-bf-async" (String.t): Set to true to submit this request as an async job. Returns immediately with a job ID. Not compatible with streaming.
    • :"x-bf-async-id" (String.t): Poll for results of a previously submitted async job by providing the job ID returned from the initial async request.
    • :"x-bf-async-job-result-ttl" (integer()): Override the default result TTL in seconds. Results expire after this duration from completion time.

Returns

  • {:ok, ExBifrost.Model.AnthropicMessageResponse.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_create_message_wildcard(connection, path, anthropic_message_request, opts \\ [])

Create message (Anthropic format) - wildcard Handles extended messages API paths.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • path (String.t): Extended path
  • anthropic_message_request (AnthropicMessageRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, ExBifrost.Model.AnthropicMessageResponse.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_delete_file(connection, file_id, opts \\ [])

Delete file (Anthropic format) Deletes an uploaded file.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file_id (String.t): File ID to delete
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider for the file

Returns

  • {:ok, ExBifrost.Model.AnthropicDeleteFile200Response.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_get_batch_results(connection, batch_id, opts \\ [])

@spec anthropic_get_batch_results(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, ExBifrost.Model.AnthropicCreateMessage400Response.t()}
  | {:ok, String.t()}
  | {:error, Tesla.Env.t()}

Get batch results (Anthropic format) Retrieves results of a completed batch job.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • batch_id (String.t): Batch job ID
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider for the batch

Returns

  • {:ok, String.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_get_file_content(connection, file_id, opts \\ [])

Get file content (Anthropic format) Retrieves file content. Returns raw binary file data when Accept header is set to application/octet-stream, or file metadata as JSON when Accept header is set to application/json.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file_id (String.t): File ID
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider for the file
    • :Accept (String.t): Response content type - use application/octet-stream for binary download

Returns

  • {:ok, ExBifrost.Model.AnthropicListFiles200ResponseDataInner.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_list_batches(connection, opts \\ [])

List batch jobs (Anthropic format) Lists batch processing jobs.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider to use (defaults to anthropic)
    • :page_size (integer()): Maximum number of batches to return
    • :page_token (String.t): Cursor for pagination

Returns

  • {:ok, ExBifrost.Model.AnthropicListBatches200Response.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_list_files(connection, opts \\ [])

List files (Anthropic format) Lists uploaded files.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider to use (defaults to anthropic)
    • :limit (integer()): Maximum files to return
    • :after_id (String.t): Cursor for pagination

Returns

  • {:ok, ExBifrost.Model.AnthropicListFiles200Response.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_list_models(connection, opts \\ [])

List models (Anthropic format) Lists available models in Anthropic format.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :limit (integer()): Maximum number of models to return
    • :before_id (String.t): Return models before this ID
    • :after_id (String.t): Return models after this ID

Returns

  • {:ok, ExBifrost.Model.AnthropicListModelsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_retrieve_batch(connection, batch_id, opts \\ [])

Retrieve batch job (Anthropic format) Retrieves details of a batch processing job.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • batch_id (String.t): Batch job ID
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider for the batch

Returns

  • {:ok, ExBifrost.Model.AnthropicListBatches200ResponseDataInner.t} on success
  • {:error, Tesla.Env.t} on failure

anthropic_upload_file(connection, file, opts \\ [])

Upload file (Anthropic format) Uploads a file. Use x-model-provider header to specify the provider.

Parameters

  • connection (ExBifrost.Connection): Connection to server
  • file (String.t): File to upload (raw file content)
  • opts (keyword): Optional parameters
    • :"x-model-provider" (String.t): Provider to use (defaults to anthropic)
    • :filename (String.t): Original filename
    • :purpose (String.t): Purpose of the file (e.g., \"batch\")

Returns

  • {:ok, ExBifrost.Model.AnthropicListFiles200ResponseDataInner.t} on success
  • {:error, Tesla.Env.t} on failure