vendor_fabric.anthropic

Anthropic connector for Claude APIs.

This connector provides Python access to Anthropic’s Claude API.

Usage: from vendor_fabric.anthropic import AnthropicConnector

# Standard API access
connector = AnthropicConnector(api_key="...")
response = connector.create_message(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}]
)

Reference: https://docs.anthropic.com/claude/reference

Submodules

Package Contents

Classes

MessageRole

Message role in conversation.

ContentBlock

Content block within a message.

Usage

Token usage information.

Message

Claude message response.

Model

Claude model information.

AnthropicConnector

Anthropic Claude API connector.

Data

API

vendor_fabric.anthropic.DEFAULT_API_URL = 'https://api.anthropic.com'
vendor_fabric.anthropic.DEFAULT_API_VERSION = '2023-06-01'
vendor_fabric.anthropic.DEFAULT_TIMEOUT = 60.0
vendor_fabric.anthropic.DEFAULT_MAX_TOKENS = 4096
vendor_fabric.anthropic.CLAUDE_MODELS = None
exception vendor_fabric.anthropic.AnthropicError(message: str, status_code: int | None = None, error_type: str | None = None)

Bases: Exception

Base exception for Anthropic API errors.

Initialization

Initialize self. See help(type(self)) for accurate signature.

add_note()
class args
with_traceback()
exception vendor_fabric.anthropic.AnthropicAuthError(message: str, status_code: int | None = None, error_type: str | None = None)

Bases: vendor_fabric.anthropic.AnthropicError

Authentication error.

Initialization

Initialize self. See help(type(self)) for accurate signature.

add_note()
class args
with_traceback()
exception vendor_fabric.anthropic.AnthropicRateLimitError(message: str, status_code: int | None = None, error_type: str | None = None)

Bases: vendor_fabric.anthropic.AnthropicError

Rate limit exceeded error.

Initialization

Initialize self. See help(type(self)) for accurate signature.

add_note()
class args
with_traceback()
exception vendor_fabric.anthropic.AnthropicAPIError(message: str, status_code: int | None = None, error_type: str | None = None)

Bases: vendor_fabric.anthropic.AnthropicError

API error from Anthropic service.

Initialization

Initialize self. See help(type(self)) for accurate signature.

add_note()
class args
with_traceback()
class vendor_fabric.anthropic.MessageRole

Bases: enum.StrEnum

Message role in conversation.

Initialization

Initialize self. See help(type(self)) for accurate signature.

USER = 'user'
ASSISTANT = 'assistant'
capitalize()
casefold()
center()
count()
encode()
endswith()
expandtabs()
find()
format()
format_map()
index()
isalnum()
isalpha()
isascii()
isdecimal()
isdigit()
isidentifier()
islower()
isnumeric()
isprintable()
isspace()
istitle()
isupper()
join()
ljust()
lower()
lstrip()
partition()
removeprefix()
removesuffix()
replace()
rfind()
rindex()
rjust()
rpartition()
rsplit()
rstrip()
split()
splitlines()
startswith()
strip()
swapcase()
title()
translate()
upper()
zfill()
name()
value()
class vendor_fabric.anthropic.ContentBlock(/, **data: Any)

Bases: pydantic.BaseModel

Content block within a message.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = 'ConfigDict(...)'
type: str = 'Field(...)'
text: str | None = 'Field(...)'
id: str | None = 'Field(...)'
name: str | None = 'Field(...)'
input: dict[str, Any] | None = 'Field(...)'
classmethod model_fields() dict[str, pydantic.fields.FieldInfo]
classmethod model_computed_fields() dict[str, pydantic.fields.ComputedFieldInfo]
property model_extra: dict[str, Any] | None
property model_fields_set: set[str]
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
model_copy(*, update: collections.abc.Mapping[str, Any] | None = None, deep: bool = False) typing_extensions.Self
model_dump(*, mode: Literal[json, python] | str = 'python', include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) dict[str, Any]
model_dump_json(*, indent: int | None = None, ensure_ascii: bool = False, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) str
classmethod model_json_schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, schema_generator: type[pydantic.json_schema.GenerateJsonSchema] = GenerateJsonSchema, mode: pydantic.json_schema.JsonSchemaMode = 'validation', *, union_format: Literal[any_of, primitive_type_array] = 'any_of') dict[str, Any]
classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
model_post_init(context: Any, /) None
classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: pydantic._internal._namespace_utils.MappingNamespace | None = None) bool | None
classmethod model_validate(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
dict(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
json(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
classmethod parse_obj(obj: Any) typing_extensions.Self
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod parse_file(path: str | pathlib.Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod from_orm(obj: Any) typing_extensions.Self
classmethod construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
copy(*, include: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, exclude: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) typing_extensions.Self
classmethod schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE) Dict[str, Any]
classmethod schema_json(*, by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, **dumps_kwargs: Any) str
classmethod validate(value: Any) typing_extensions.Self
classmethod update_forward_refs(**localns: Any) None
class vendor_fabric.anthropic.Usage(/, **data: Any)

Bases: pydantic.BaseModel

Token usage information.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = 'ConfigDict(...)'
input_tokens: int = 'Field(...)'
output_tokens: int = 'Field(...)'
classmethod model_fields() dict[str, pydantic.fields.FieldInfo]
classmethod model_computed_fields() dict[str, pydantic.fields.ComputedFieldInfo]
property model_extra: dict[str, Any] | None
property model_fields_set: set[str]
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
model_copy(*, update: collections.abc.Mapping[str, Any] | None = None, deep: bool = False) typing_extensions.Self
model_dump(*, mode: Literal[json, python] | str = 'python', include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) dict[str, Any]
model_dump_json(*, indent: int | None = None, ensure_ascii: bool = False, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) str
classmethod model_json_schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, schema_generator: type[pydantic.json_schema.GenerateJsonSchema] = GenerateJsonSchema, mode: pydantic.json_schema.JsonSchemaMode = 'validation', *, union_format: Literal[any_of, primitive_type_array] = 'any_of') dict[str, Any]
classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
model_post_init(context: Any, /) None
classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: pydantic._internal._namespace_utils.MappingNamespace | None = None) bool | None
classmethod model_validate(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
dict(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
json(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
classmethod parse_obj(obj: Any) typing_extensions.Self
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod parse_file(path: str | pathlib.Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod from_orm(obj: Any) typing_extensions.Self
classmethod construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
copy(*, include: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, exclude: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) typing_extensions.Self
classmethod schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE) Dict[str, Any]
classmethod schema_json(*, by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, **dumps_kwargs: Any) str
classmethod validate(value: Any) typing_extensions.Self
classmethod update_forward_refs(**localns: Any) None
class vendor_fabric.anthropic.Message(/, **data: Any)

Bases: pydantic.BaseModel

Claude message response.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = 'ConfigDict(...)'
id: str = 'Field(...)'
type: str = 'Field(...)'
role: vendor_fabric.anthropic.MessageRole = 'Field(...)'
content: list[vendor_fabric.anthropic.ContentBlock] = 'Field(...)'
model: str = 'Field(...)'
stop_reason: str | None = 'Field(...)'
stop_sequence: str | None = 'Field(...)'
usage: vendor_fabric.anthropic.Usage = 'Field(...)'
property text: str

Get the text content of the message.

classmethod model_fields() dict[str, pydantic.fields.FieldInfo]
classmethod model_computed_fields() dict[str, pydantic.fields.ComputedFieldInfo]
property model_extra: dict[str, Any] | None
property model_fields_set: set[str]
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
model_copy(*, update: collections.abc.Mapping[str, Any] | None = None, deep: bool = False) typing_extensions.Self
model_dump(*, mode: Literal[json, python] | str = 'python', include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) dict[str, Any]
model_dump_json(*, indent: int | None = None, ensure_ascii: bool = False, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) str
classmethod model_json_schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, schema_generator: type[pydantic.json_schema.GenerateJsonSchema] = GenerateJsonSchema, mode: pydantic.json_schema.JsonSchemaMode = 'validation', *, union_format: Literal[any_of, primitive_type_array] = 'any_of') dict[str, Any]
classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
model_post_init(context: Any, /) None
classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: pydantic._internal._namespace_utils.MappingNamespace | None = None) bool | None
classmethod model_validate(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
dict(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
json(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
classmethod parse_obj(obj: Any) typing_extensions.Self
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod parse_file(path: str | pathlib.Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod from_orm(obj: Any) typing_extensions.Self
classmethod construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
copy(*, include: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, exclude: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) typing_extensions.Self
classmethod schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE) Dict[str, Any]
classmethod schema_json(*, by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, **dumps_kwargs: Any) str
classmethod validate(value: Any) typing_extensions.Self
classmethod update_forward_refs(**localns: Any) None
class vendor_fabric.anthropic.Model(/, **data: Any)

Bases: pydantic.BaseModel

Claude model information.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = 'ConfigDict(...)'
id: str = 'Field(...)'
display_name: str = 'Field(...)'
created_at: datetime.datetime | None = 'Field(...)'
classmethod model_fields() dict[str, pydantic.fields.FieldInfo]
classmethod model_computed_fields() dict[str, pydantic.fields.ComputedFieldInfo]
property model_extra: dict[str, Any] | None
property model_fields_set: set[str]
classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
model_copy(*, update: collections.abc.Mapping[str, Any] | None = None, deep: bool = False) typing_extensions.Self
model_dump(*, mode: Literal[json, python] | str = 'python', include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) dict[str, Any]
model_dump_json(*, indent: int | None = None, ensure_ascii: bool = False, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal[none, warn, error] = True, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, polymorphic_serialization: bool | None = None) str
classmethod model_json_schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, schema_generator: type[pydantic.json_schema.GenerateJsonSchema] = GenerateJsonSchema, mode: pydantic.json_schema.JsonSchemaMode = 'validation', *, union_format: Literal[any_of, primitive_type_array] = 'any_of') dict[str, Any]
classmethod model_parametrized_name(params: tuple[type[Any], ...]) str
model_post_init(context: Any, /) None
classmethod model_rebuild(*, force: bool = False, raise_errors: bool = True, _parent_namespace_depth: int = 2, _types_namespace: pydantic._internal._namespace_utils.MappingNamespace | None = None) bool | None
classmethod model_validate(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, from_attributes: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_json(json_data: str | bytes | bytearray, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, extra: pydantic.config.ExtraValues | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) typing_extensions.Self
dict(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) Dict[str, Any]
json(*, include: pydantic.main.IncEx | None = None, exclude: pydantic.main.IncEx | None = None, by_alias: bool = False, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Callable[[Any], Any] | None = PydanticUndefined, models_as_dict: bool = PydanticUndefined, **dumps_kwargs: Any) str
classmethod parse_obj(obj: Any) typing_extensions.Self
classmethod parse_raw(b: str | bytes, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod parse_file(path: str | pathlib.Path, *, content_type: str | None = None, encoding: str = 'utf8', proto: pydantic.deprecated.parse.Protocol | None = None, allow_pickle: bool = False) typing_extensions.Self
classmethod from_orm(obj: Any) typing_extensions.Self
classmethod construct(_fields_set: set[str] | None = None, **values: Any) typing_extensions.Self
copy(*, include: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, exclude: pydantic._internal._utils.AbstractSetIntStr | pydantic._internal._utils.MappingIntStrAny | None = None, update: Dict[str, Any] | None = None, deep: bool = False) typing_extensions.Self
classmethod schema(by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE) Dict[str, Any]
classmethod schema_json(*, by_alias: bool = True, ref_template: str = DEFAULT_REF_TEMPLATE, **dumps_kwargs: Any) str
classmethod validate(value: Any) typing_extensions.Self
classmethod update_forward_refs(**localns: Any) None
class vendor_fabric.anthropic.AnthropicConnector(api_key: str | None = None, api_version: str = DEFAULT_API_VERSION, timeout: float = DEFAULT_TIMEOUT, logger: extended_data.logging.Logging | None = None, **kwargs: Any)

Bases: vendor_fabric.base.ConnectorBase

Anthropic Claude API connector.

Provides HTTP client access to Anthropic’s Claude API for message generation and model metadata.

Args: api_key: Anthropic API key. Defaults to ANTHROPIC_API_KEY env var. api_version: API version string. Default “2023-06-01”. timeout: Request timeout in seconds. Default 60s. logger: Optional logger instance. **kwargs: Additional InputProvider arguments.

Example: >>> connector = AnthropicConnector() >>> response = connector.create_message( … model=”claude-sonnet-4-20250514”, … max_tokens=1024, … messages=[{“role”: “user”, “content”: “Hello”}] … ) >>> print(response[“content”][0][“text”])

Initialization

Initialize the connector.

Args: api_key: API key (overrides environment variable) base_url: Base URL (overrides class default) timeout: HTTP timeout in seconds logger: Logger instance **kwargs: Passed to InputProvider

API_KEY_ENV = 'ANTHROPIC_API_KEY'
BASE_URL = None
static is_available() bool

Check if API key is available.

Returns: True if ANTHROPIC_API_KEY is set in environment.

static get_available_models() extended_data.containers.ExtendedDict

Get dictionary of available Claude models.

Returns: Extended dictionary mapping model IDs to display names.

create_message(model: str, max_tokens: int, messages: list[dict[str, Any]], system: str | None = None, temperature: float | None = None, top_p: float | None = None, top_k: int | None = None, stop_sequences: list[str] | None = None, tools: list[dict[str, Any]] | None = None, tool_choice: dict[str, Any] | None = None, metadata: dict[str, Any] | None = None) extended_data.containers.ExtendedDict

Create a message using Claude.

Args: model: Model ID (e.g., “claude-sonnet-4-20250514”). max_tokens: Maximum tokens to generate. messages: List of message dicts with role and content. system: Optional system prompt. temperature: Sampling temperature (0-1). top_p: Top-p sampling parameter. top_k: Top-k sampling parameter. stop_sequences: Stop sequences to end generation. tools: Tool definitions for function calling. tool_choice: Tool choice configuration. metadata: Optional metadata for the request.

Returns: Message response payload.

Raises: AnthropicError: If the API request fails.

count_tokens(model: str, messages: list[dict[str, Any]], system: str | None = None, tools: list[dict[str, Any]] | None = None) int

Count tokens for a set of messages.

Args: model: Model ID. messages: List of message dicts. system: Optional system prompt. tools: Optional tool definitions.

Returns: Token count.

Raises: AnthropicError: If the API request fails.

list_models() extended_data.containers.ExtendedList[extended_data.containers.ExtendedDict]

List available models from the API.

Returns: List of model payload dictionaries.

Raises: AnthropicError: If the API request fails.

get_model(model_id: str) extended_data.containers.ExtendedDict

Get information about a specific model.

Args: model_id: Model identifier.

Returns: Model payload dictionary with details.

Raises: AnthropicError: If the API request fails.

validate_model(model_id: str) bool

Check if a model ID is valid.

Args: model_id: Model identifier to validate.

Returns: True if model exists in known models.

Get recommended model for a use case.

Args: use_case: Use case type (“general”, “coding”, “fast”, “powerful”).

Returns: Recommended model ID.

CONNECTOR_CATEGORY: ClassVar[str] = 'external'
CONNECTOR_CAPABILITIES: ClassVar[tuple[str, ...]] = ()
TIMEOUT: ClassVar[float] = 300.0
MIN_REQUEST_INTERVAL: ClassVar[float] = 0.0
MAX_RETRIES: ClassVar[int] = 5
property api_key: str
property client: httpx.Client
close() None
request(method: str, endpoint: str, *, headers: dict[str, str] | None = None, **kwargs: Any) httpx.Response
decode_response(response: httpx.Response, *, suffix: str | None = None, as_extended: bool = True) Any
decode_response_file(response: httpx.Response, *, source: str | None = None, suffix: str | None = None, as_extended: bool = True, metadata: collections.abc.Mapping[str, Any] | None = None) extended_data.io.DataFile
extend_result(value: Any) Any
request_data(method: str, endpoint: str, *, headers: dict[str, str] | None = None, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
request_data_file(method: str, endpoint: str, *, headers: dict[str, str] | None = None, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.io.DataFile
request_workflow(method: str, endpoint: str, *, headers: dict[str, str] | None = None, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
get(endpoint: str, **kwargs: Any) httpx.Response
get_data(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
get_workflow(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
post(endpoint: str, **kwargs: Any) httpx.Response
post_data(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
post_workflow(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
put(endpoint: str, **kwargs: Any) httpx.Response
put_data(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
put_workflow(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
delete(endpoint: str, **kwargs: Any) httpx.Response
delete_data(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
delete_workflow(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
patch(endpoint: str, **kwargs: Any) httpx.Response
patch_data(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) Any
patch_workflow(endpoint: str, *, suffix: str | None = None, as_extended: bool = True, **kwargs: Any) extended_data.workflows.DataWorkflow
download(url: str, output_path: str) int
vendor_capabilities: ClassVar[dict[str, vendor_fabric.capabilities.CapabilitySpec]] = None
vendor_capability_methods: ClassVar[dict[str, str]] = None
get_input(k: str, default: Any | None = None, required: bool = False, is_bool: bool = False, is_integer: bool = False, is_float: bool = False, is_path: bool = False, is_datetime: bool = False, as_extended: bool = False) Any
decode_input(k: str, default: Any | None = None, required: bool = False, decode_from_json: bool = False, decode_from_yaml: bool = False, decode_from_base64: bool = False, allow_none: bool = True, as_extended: bool = False) Any
freeze_inputs() extended_data.containers.mappings.ExtendedDict
thaw_inputs() extended_data.containers.mappings.ExtendedDict
snapshot_inputs(*, frozen: bool = False) extended_data.containers.mappings.ExtendedDict
replace_inputs(new_inputs: collections.abc.Mapping[str, Any] | None, *, clear_frozen: bool = True) extended_data.containers.mappings.ExtendedDict
merge_inputs(new_inputs: collections.abc.Mapping[str, Any] | None) extended_data.containers.mappings.ExtendedDict
shift_inputs() extended_data.containers.mappings.ExtendedDict