core.async_client_base
Async abstract base class for AI client implementations.
Mirrors FFAIClientBase but with generate_response and clone
as async methods. In-memory operations (conversation history get/set,
clear) remain synchronous.
Async abstract base class for AI client implementations.
Mirrors FFAIClientBase but with generate_response and clone
as async methods. In-memory operations (conversation history get/set,
clear) remain synchronous.
- class AsyncFFAIClientBase[source]
Bases:
FFAIClientBaseAsync variant of
FFAIClientBasefor use withexecute_graph.Subclasses must implement
generate_responseandcloneas async methods. All other methods (clear_conversation,get_conversation_history,set_conversation_history) remain synchronous because they operate on in-memory lists.- abstractmethod async generate_response(prompt, **kwargs)[source]
Generate a response from the AI model.
Classes
- class AsyncFFAIClientBase[source]
Bases:
FFAIClientBaseAsync variant of
FFAIClientBasefor use withexecute_graph.Subclasses must implement
generate_responseandcloneas async methods. All other methods (clear_conversation,get_conversation_history,set_conversation_history) remain synchronous because they operate on in-memory lists.- abstractmethod async generate_response(prompt, **kwargs)[source]
Generate a response from the AI model.
- abstractmethod async clone()[source]
Create a fresh async clone of this client with empty history.
- Returns:
New
AsyncFFAIClientBaseinstance with same config, empty history.- Return type:
- add_tool_result(tool_call_id, content)
Add a tool result to the conversation history.
Default implementation appends a tool-role message. Subclasses that manage conversation history differently (e.g. via an external API) should override this method.
- abstractmethod clear_conversation()
Clear the conversation history.
- Return type:
None
- configure_retry(retry_config=None)
Configure retry behavior for this client.
- abstractmethod get_conversation_history()
Get the conversation history.
- static get_default_retry_config()
Get default retry configuration from global config.
- property last_duration_ms: float | None
Wall-clock duration in ms of the most recent generate_response() call.
- property last_usage: TokenUsage | None
Token usage from the most recent generate_response() call.
- abstractmethod set_conversation_history(history)
Set the conversation history.