AnthropicLLMConfigEntry - AG2

AnthropicLLMConfigEntry

autogen.oai.anthropic.AnthropicLLMConfigEntry

Bases: LLMConfigEntry

api_type

api_type = 'anthropic'

temperature

temperature = Field(default=1.0, ge=0.0, le=1.0)

top_k

top_k = Field(default=None, ge=1)

top_p

top_p = Field(default=None, ge=0.0, le=1.0)

stop_sequences

stop_sequences = None

stream

stream = False

max_tokens

max_tokens = Field(default=4096, ge=1)

tool_choice

tool_choice = None

gcp_project_id

gcp_project_id = None

gcp_region

gcp_region = None

gcp_auth_token

gcp_auth_token = None

model

model = Field(..., min_length=1)

api_key

api_key = None

api_version

api_version = None

base_url

base_url = None

voice

voice = None

model_client_cls

model_client_cls = None

http_client

http_client = None

response_format

response_format = None

default_headers

default_headers = None

tags

tags = Field(default_factory=list)

model_config

model_config = ConfigDict(extra='forbid', arbitrary_types_allowed=True)

create_client

create_client()

Source code in autogen/oai/anthropic.py

<br>126<br>127<br> <br>def create_client(self):<br> raise NotImplementedError("AnthropicLLMConfigEntry.create_client is not implemented.")<br>

check_base_url

check_base_url(v, info)

Source code in autogen/llm_config.py

<br>299<br>300<br>301<br>302<br>303<br>304<br> <br>@field_validator("base_url", mode="before")<br>@classmethod<br>def check_base_url(cls, v: Any, info: ValidationInfo) -> Any:<br> if not str(v).startswith("https://") and not str(v).startswith("http://"):<br> v = f"http://{str(v)}"<br> return v<br>

serialize_base_url

serialize_base_url(v)

Source code in autogen/llm_config.py

<br>306<br>307<br>308<br> <br>@field_serializer("base_url")<br>def serialize_base_url(self, v: Any) -> Any:<br> return str(v)<br>

serialize_api_key

serialize_api_key(v)

Source code in autogen/llm_config.py

<br>310<br>311<br>312<br> <br>@field_serializer("api_key", when_used="unless-none")<br>def serialize_api_key(self, v: SecretStr) -> Any:<br> return v.get_secret_value()<br>

model_dump

model_dump(*args, exclude_none=True, **kwargs)

Source code in autogen/llm_config.py

<br>314<br>315<br> <br>def model_dump(self, *args: Any, exclude_none: bool = True, **kwargs: Any) -> dict[str, Any]:<br> return BaseModel.model_dump(self, exclude_none=exclude_none, *args, **kwargs)<br>

model_dump_json

model_dump_json(*args, exclude_none=True, **kwargs)

Source code in autogen/llm_config.py

<br>317<br>318<br> <br>def model_dump_json(self, *args: Any, exclude_none: bool = True, **kwargs: Any) -> str:<br> return BaseModel.model_dump_json(self, exclude_none=exclude_none, *args, **kwargs)<br>

get

get(key, default=None)

Source code in autogen/llm_config.py

<br>320<br>321<br>322<br>323<br>324<br> <br>def get(self, key: str, default: Optional[Any] = None) -> Any:<br> val = getattr(self, key, default)<br> if isinstance(val, SecretStr):<br> return val.get_secret_value()<br> return val<br>

items

items()

Source code in autogen/llm_config.py

<br>341<br>342<br>343<br> <br>def items(self) -> Iterable[tuple[str, Any]]:<br> d = self.model_dump()<br> return d.items()<br>

keys

keys()

Source code in autogen/llm_config.py

<br>345<br>346<br>347<br> <br>def keys(self) -> Iterable[str]:<br> d = self.model_dump()<br> return d.keys()<br>

values

values()

Source code in autogen/llm_config.py

<br>349<br>350<br>351<br> <br>def values(self) -> Iterable[Any]:<br> d = self.model_dump()<br> return d.values()<br>