UserAgent
Base classes
| Name |
Children |
Inherits |
BaseModel pydantic.main !!! abstract "Usage Documentation" |
|
|
⋔ Inheritance diagram
graph TD
107846716984528["config.UserAgent"]
107846697802608["main.BaseModel"]
137699722799616["builtins.object"]
107846697802608 --> 107846716984528
137699722799616 --> 107846697802608
🛈 DocStrings
Bases: BaseModel
An agent entry of config.toml (the table key is its id).
Source code in src/acptui/config.py
| class UserAgent(BaseModel):
"""An agent entry of ``config.toml`` (the table key is its id)."""
model_config = ConfigDict(extra="forbid")
name: str | None = None
command: str | Sequence[str] | None = None
url: str | None = None
env: dict[str, str] = Field(default_factory=dict)
headers: dict[str, str] = Field(default_factory=dict)
description: str = ""
options: dict[str, str | bool] = Field(default_factory=dict)
def to_spec(self, agent_id: str) -> AgentSpec:
"""Build the agent spec."""
match self.command:
case None:
command: tuple[str, ...] = ()
case str():
command = tuple(self.command.split())
case _:
command = tuple(self.command)
return AgentSpec(
id=agent_id,
name=self.name or agent_id,
command=command,
url=self.url,
env=self.env,
headers=self.headers,
description=self.description,
options=self.options,
)
|
to_spec
Build the agent spec.
Source code in src/acptui/config.py
| def to_spec(self, agent_id: str) -> AgentSpec:
"""Build the agent spec."""
match self.command:
case None:
command: tuple[str, ...] = ()
case str():
command = tuple(self.command.split())
case _:
command = tuple(self.command)
return AgentSpec(
id=agent_id,
name=self.name or agent_id,
command=command,
url=self.url,
env=self.env,
headers=self.headers,
description=self.description,
options=self.options,
)
|
:fa-brands-github: Show source on GitHub