LLM backends#

Turn a request into a reply: the one external seam of a campaign. See LLM backends.

Interface#

factor_agent.llm.base.LLMBackend

Anything that completes a request.

factor_agent.llm.base.Request

One call: the role making it, the model, the prompt and the sampling parameters.

factor_agent.llm.base.Reply

The provider's answer: its text, token usage as the provider reports it and the model that answered.

factor_agent.llm.base.ProviderQuotaExhausted

The provider refuses calls because the balance or quota is exhausted; its message says so in its words.

factor_agent.llm.base.ProviderReplyMalformed

The provider answered, without an error, something that is not a reply; its message says what it lacked.

factor_agent.llm.base.AskingAgain

A backend that asks backend again when it answers something that is not a reply.

factor_agent.llm.base.make_backend

Build the backend a role's config names in spec["backend"].

Backends#

factor_agent.llm.openai_compatible.OpenAICompatibleBackend

Complete a request with one chat-completions call.

factor_agent.llm.anthropic.AnthropicBackend

Complete a request with one Messages API call.

factor_agent.llm.claude_code.ClaudeCodeBackend

Complete a request with one headless Claude Code call.

factor_agent.llm.replay.ReplayBackend

Answer each request with the recorded reply to the same role, model and prompt.

factor_agent.llm.replay.ReplayExhausted

The recorded run holds no reply for a request: it ran out of calls, or the run asked something else.

factor_agent.llm.log.LLMLog

The call files of one run directory's llm_log.