kodeagent.history_formatter.LLMMessage#
- class kodeagent.history_formatter.LLMMessage(**kwargs: Any)[source]#
A dictionary subclass that hides internal metadata from LLM APIs. This is used during converstion of Pydantic structured reponse to a dict for LLM APIs.
Standard keys (role, content, tool_calls, tool_call_id, name) are stored in the dictionary itself. Non-standard keys (starting with ‘_’ or ‘files’) are stored as instance attributes. This ensures that only compliant keys are serialized to JSON or iterated over when passed to LLM APIs like LiteLLM.
Create an LLM-compliant message with hidden metadata.
- Parameters:
**kwargs – Message fields, including standard (role, content, etc.)
non-standard (and)
- __init__(**kwargs: Any)[source]#
Create an LLM-compliant message with hidden metadata.
- Parameters:
**kwargs – Message fields, including standard (role, content, etc.)
non-standard (and)
Methods
__init__(**kwargs)Create an LLM-compliant message with hidden metadata.
clear()copy()fromkeys([value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Get a value with an optional default, checking both storage and attributes.
items()keys()pop(k[,d])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update(*args, **kwargs)Update standard keys or metadata.
values()