angr.llm_client¶
- class angr.llm_client.AgentKind¶
Bases:
EnumThe kind of pydantic-ai Agent to retrieve from the LLMClient cache.
- STRING = 'string'¶
- STRUCTURED = 'structured'¶
- class angr.llm_client.LLMClient¶
Bases:
objectA client for interacting with LLMs via pydantic-ai. Used by the decompiler to suggest improved variable names, function names, and types.
- __init__(model, api_key=None, api_base=None, max_tokens=4096, temperature=0.0)¶
- infer_provider(provider)¶
Infer the provider from the provider name.
- classmethod from_env()¶
Create an LLMClient from environment variables.
Uses ANGR_LLM_MODEL (required), ANGR_LLM_API_KEY (optional), and ANGR_LLM_API_BASE (optional). Returns None if ANGR_LLM_MODEL is not set.
- completion(messages, **kwargs)¶
Call the LLM with the given messages and return the response text.
- completion_structured(messages, output_type, raise_exc=False, **kwargs)¶
Call the LLM with the given messages and return a validated Pydantic model. Returns None if the call fails.
- completion_json(messages, raise_exc=False, **kwargs)¶
Call the LLM and parse the response as JSON. Strips markdown code fences if present. Returns None on parse failure. Kept for backwards compatibility; prefer completion_structured().