anthropic/testing
Testing utilities for Anthropic API client
This module provides mock responses, test fixtures, and helpers for testing code that uses the anthropic_gleam library.
Values
pub fn fixture_conversation_response() -> request.CreateMessageResponse
A multi-turn conversation response fixture
pub fn fixture_max_tokens_response() -> request.CreateMessageResponse
A max tokens response fixture
pub fn fixture_simple_response() -> request.CreateMessageResponse
A simple text response fixture
pub fn fixture_stop_sequence_response() -> request.CreateMessageResponse
A stop sequence response fixture
pub fn fixture_tool_use_response() -> request.CreateMessageResponse
A tool use response fixture
pub fn mock_auth_error() -> response.Response(String)
Create a mock authentication error response
pub fn mock_error_body(
error_type: String,
message: String,
) -> String
Build a mock error body JSON
pub fn mock_error_response(
status_code: Int,
error_type: String,
message: String,
) -> response.Response(String)
Create a mock error response
pub fn mock_invalid_request_error(
message: String,
) -> response.Response(String)
Create a mock invalid request error response
pub fn mock_overloaded_error() -> response.Response(String)
Create a mock overloaded error response
pub fn mock_rate_limit_error() -> response.Response(String)
Create a mock rate limit error response
pub fn mock_text_response(
text: String,
) -> response.Response(String)
Create a mock successful text response
pub fn mock_text_response_body(
id: String,
text: String,
) -> String
Build a mock text response body JSON
pub fn mock_tool_use_response(
tool_id: String,
tool_name: String,
tool_input: String,
) -> response.Response(String)
Create a mock successful tool use response
pub fn mock_tool_use_response_body(
id: String,
tool_id: String,
tool_name: String,
tool_input: String,
) -> String
Build a mock tool use response body JSON