Skip to content

AnthropicLLMConfigEntry

autogen.oai.anthropic.AnthropicLLMConfigEntry #

Bases: LLMConfigEntry

api_type class-attribute instance-attribute #

api_type = 'anthropic'

temperature class-attribute instance-attribute #

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

top_k class-attribute instance-attribute #

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

top_p class-attribute instance-attribute #

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

stop_sequences class-attribute instance-attribute #

stop_sequences = None

stream class-attribute instance-attribute #

stream = False

max_tokens class-attribute instance-attribute #

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

tool_choice class-attribute instance-attribute #

tool_choice = None

gcp_project_id class-attribute instance-attribute #

gcp_project_id = None

gcp_region class-attribute instance-attribute #

gcp_region = None

gcp_auth_token class-attribute instance-attribute #

gcp_auth_token = None

model class-attribute instance-attribute #

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

api_key class-attribute instance-attribute #

api_key = None

api_version class-attribute instance-attribute #

api_version = None

base_url class-attribute instance-attribute #

base_url = None

voice class-attribute instance-attribute #

voice = None

model_client_cls class-attribute instance-attribute #

model_client_cls = None

http_client class-attribute instance-attribute #

http_client = None

response_format class-attribute instance-attribute #

response_format = None

default_headers class-attribute instance-attribute #

default_headers = None

tags class-attribute instance-attribute #

tags = Field(default_factory=list)

model_config class-attribute instance-attribute #

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

create_client #

create_client()
Source code in autogen/oai/anthropic.py
def create_client(self):
    raise NotImplementedError("AnthropicLLMConfigEntry.create_client is not implemented.")

check_base_url classmethod #

check_base_url(v, info)
Source code in autogen/llm_config.py
@field_validator("base_url", mode="before")
@classmethod
def check_base_url(cls, v: Any, info: ValidationInfo) -> Any:
    if not str(v).startswith("https://") and not str(v).startswith("http://"):
        v = f"http://{str(v)}"
    return v

serialize_base_url #

serialize_base_url(v)
Source code in autogen/llm_config.py
@field_serializer("base_url")
def serialize_base_url(self, v: Any) -> Any:
    return str(v)

serialize_api_key #

serialize_api_key(v)
Source code in autogen/llm_config.py
@field_serializer("api_key", when_used="unless-none")
def serialize_api_key(self, v: SecretStr) -> Any:
    return v.get_secret_value()

model_dump #

model_dump(*args, exclude_none=True, **kwargs)
Source code in autogen/llm_config.py
def model_dump(self, *args: Any, exclude_none: bool = True, **kwargs: Any) -> dict[str, Any]:
    return BaseModel.model_dump(self, exclude_none=exclude_none, *args, **kwargs)

model_dump_json #

model_dump_json(*args, exclude_none=True, **kwargs)
Source code in autogen/llm_config.py
def model_dump_json(self, *args: Any, exclude_none: bool = True, **kwargs: Any) -> str:
    return BaseModel.model_dump_json(self, exclude_none=exclude_none, *args, **kwargs)

get #

get(key, default=None)
Source code in autogen/llm_config.py
def get(self, key: str, default: Optional[Any] = None) -> Any:
    val = getattr(self, key, default)
    if isinstance(val, SecretStr):
        return val.get_secret_value()
    return val

items #

items()
Source code in autogen/llm_config.py
def items(self) -> Iterable[tuple[str, Any]]:
    d = self.model_dump()
    return d.items()

keys #

keys()
Source code in autogen/llm_config.py
def keys(self) -> Iterable[str]:
    d = self.model_dump()
    return d.keys()

values #

values()
Source code in autogen/llm_config.py
def values(self) -> Iterable[Any]:
    d = self.model_dump()
    return d.values()