Module exposed

Module exposed 

Source
Expand description

Exposed namespace of the module.

Structs§

BatchProcessor
A client wrapper that supports batch processing of requests.
CachedClient
A client wrapper that caches chat completion responses.
Chat
Chat completions API accessor.
ChatCompletionChunk
Streaming chunk from chat completion.
ChatCompletionRequest
Request to create a chat completion.
ChatCompletionResponse
Response from chat completion request.
Choice
A single completion choice.
ChunkChoice
A single streaming choice.
CircuitBreaker
Circuit breaker for protecting against cascading failures.
CircuitBreakerConfig
Circuit breaker configuration.
Client
XAI API client.
Delta
Incremental message update in streaming.
EnhancedRetryConfig
Enhanced retry configuration with exponential backoff.
FailoverConfig
Failover configuration.
FailoverManager
Failover manager for multiple XAI endpoints.
Function
Function specification.
FunctionCall
Function call details.
HealthCheckResult
Result of a health check.
ListModelsResponse
Response from listing all available models.
Message
A single message in a chat conversation.
MetricGuard
A wrapper that automatically records metrics for operations.
MetricsCollector
Metrics collector for XAI API operations.
Model
Information about a specific model.
Models
Models API accessor.
RateLimiter
Token bucket rate limiter.
RateLimiterConfig
Rate limiter configuration using token bucket algorithm.
Secret
Secure wrapper for XAI API key.
SyncCachedClient
Synchronous wrapper for cached_create (requires caching feature).
SyncClient
A synchronous (blocking) wrapper around the async XAI client.
SyncStreamIterator
Synchronous iterator wrapper around async streaming.
Tool
Tool definition for function calling.
ToolCall
Tool call made by the assistant.
ToolResult
Result of executing a tool call.
Usage
Token usage information for API requests.
XaiEnvironmentImpl
Default implementation of XAI environment configuration.

Enums§

CircuitState
Circuit breaker states.
EndpointHealth
Endpoint health status.
HealthStatus
Health status of the API endpoint.
Role
Message role in a conversation.
XaiError
Error types for XAI API operations.

Constants§

DEFAULT_BASE_URL
Default base URL for XAI API.
DEFAULT_TIMEOUT_SECS
Default request timeout in seconds.

Traits§

ClientApiAccessors
Trait providing convenient API accessors for the client.
XaiEnvironment
Environment configuration trait for XAI API client.

Functions§

count_tokens
Counts tokens in a text string for a specific model.
count_tokens_for_request
Counts tokens in a chat completion request.
create_operation_span
Creates a tracing span for tracking an API operation.
execute_tool_calls_parallel
Executes multiple tool calls in parallel.
execute_tool_calls_sequential
Executes multiple tool calls sequentially.
health_check
Performs a health check on the XAI API endpoint.
liveness_check
Performs a quick liveness check.
readiness_check
Performs a readiness check.
sync_count_tokens
Synchronous wrapper for count_tokens (requires count_tokens feature).
sync_count_tokens_for_request
Synchronous wrapper for count_tokens_for_request (requires count_tokens feature).
sync_validate_request_size
Synchronous wrapper for validate_request_size (requires count_tokens feature).
to_curl
Converts a chat completion request to a CURL command.
to_curl_compact
Converts a chat completion request to a compact CURL command (single line).
to_curl_with_endpoint
Converts a chat completion request to a CURL command with custom endpoint.
to_curl_with_key
Converts a chat completion request to a CURL command with a custom API key.
validate_frequency_penalty
Validates that frequency_penalty is within valid range [-2.0, 2.0].
validate_max_tokens
Validates that max_tokens is positive.
validate_messages
Validates that messages array is non-empty with valid content.
validate_model
Validates that the model name is supported.
validate_presence_penalty
Validates that presence_penalty is within valid range [-2.0, 2.0].
validate_request
Validates a chat completion request.
validate_request_size
Validates that a request fits within the model’s context window.
validate_temperature
Validates that temperature is within valid range [0.0, 2.0].
validate_tools
Validates tool definitions (function calling schemas).
validate_top_p
Validates that top_p is within valid range [0.0, 1.0].

Type Aliases§

Result
Result type alias using error_tools.