Skip to content

CohereLLMConfigEntry

autogen.oai.cohere.CohereLLMConfigEntry #

Bases: LLMConfigEntry

api_type class-attribute instance-attribute #

api_type = 'cohere'

temperature class-attribute instance-attribute #

temperature = Field(default=0.3, ge=0)

max_tokens class-attribute instance-attribute #

max_tokens = Field(default=None, ge=0)

k class-attribute instance-attribute #

k = Field(default=0, ge=0, le=500)

p class-attribute instance-attribute #

p = Field(default=0.75, ge=0.01, le=0.99)

seed class-attribute instance-attribute #

seed = None

frequency_penalty class-attribute instance-attribute #

frequency_penalty = Field(default=0, ge=0, le=1)

presence_penalty class-attribute instance-attribute #

presence_penalty = Field(default=0, ge=0, le=1)

client_name class-attribute instance-attribute #

client_name = None

strict_tools class-attribute instance-attribute #

strict_tools = False

stream class-attribute instance-attribute #

stream = False

tool_choice class-attribute instance-attribute #

tool_choice = 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/cohere.py
def create_client(self):
    raise NotImplementedError("CohereLLMConfigEntry.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()