Compare commits

...

1 Commits

Author SHA1 Message Date
HAL9000 ef7e999df1 docs(spec): align AIProviderInterface with implementation (generate_changes/stream_changes)
CI / lint (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 43s
CI / security (pull_request) Successful in 59s
CI / build (pull_request) Successful in 38s
CI / helm (pull_request) Successful in 45s
CI / push-validation (pull_request) Successful in 23s
CI / e2e_tests (pull_request) Successful in 3m6s
CI / integration_tests (pull_request) Successful in 4m35s
CI / unit_tests (pull_request) Successful in 6m36s
CI / docker (pull_request) Successful in 1m16s
CI / coverage (pull_request) Successful in 11m23s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m10s
Relates to #5801

The spec defined AIProviderInterface as a model factory with create_chat_model()
and create_embedding_model() methods. The implementation uses a higher-level
plan-execution interface with generate_changes() and stream_changes().

The implementation's approach is more appropriate — it directly handles plan
execution rather than exposing raw LangChain model creation. The ProviderRegistry
manages provider selection and configuration at a higher level.

Updated AIProviderInterface to match the actual implementation:
- provider_name -> name (property)
- capabilities -> model_id (property)
- create_chat_model() -> generate_changes() (plan execution)
- create_embedding_model() -> stream_changes() (streaming plan execution)

Also updated the description: auto-discovery of langchain-* packages is not
implemented; instead, providers are discovered based on configured API keys.
2026-04-09 11:38:06 +00:00
+35 -14
View File
@@ -46427,31 +46427,52 @@ Actors can be extended through:
1. **YAML-defined agents**: Single LLM actors with custom system prompts, temperature settings, tool bindings, and capability constraints.
2. **YAML-defined graphs**: LangGraph topologies with multiple actors and tool nodes connected by edges, conditional routing, and parallel execution groups.
3. **Provider extension**: New LLM providers can be added by implementing the `AIProviderInterface` protocol and registering with the `ProviderRegistry`. The registry uses auto-discovery to detect installed `langchain-*` packages.
3. **Provider extension**: New LLM providers can be added by implementing the `AIProviderInterface` protocol and registering with the `ProviderRegistry`. The registry discovers configured providers based on available API keys and environment variables.
<div class="highlight"><pre><code><span style="color: magenta; font-weight: 600;">from</span> typing <span style="color: magenta; font-weight: 600;">import</span> <span style="color: cyan;">Protocol</span>
<div class="highlight"><pre><code><span style="color: magenta; font-weight: 600;">from</span> collections.abc <span style="color: magenta; font-weight: 600;">import</span> <span style="color: cyan;">Callable, Iterator</span>
<span style="color: magenta; font-weight: 600;">from</span> typing <span style="color: magenta; font-weight: 600;">import</span> <span style="color: cyan;">Protocol</span>
<span style="color: magenta; font-weight: 600;">class</span> <span style="color: cyan; font-weight: 600;">AIProviderInterface</span>(<span style="color: cyan;">Protocol</span>):
<span style="color: #888;">"""Protocol for LLM provider implementations."""</span>
<span style="color: #888;">"""Protocol for AI providers that generate code changes.
Implementations handle plan execution directly, generating changes
based on the plan, project context, and actor configuration.
Supported providers: openai, anthropic, google, gemini, azure,
openrouter, cohere, groq, together.
"""</span>
<span style="color: cyan;">@property</span>
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">provider_name</span>(<span style="color: cyan;">self</span>) -> <span style="color: cyan;">str</span>: ...
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">name</span>(<span style="color: cyan;">self</span>) -> <span style="color: cyan;">str</span>: ...
<span style="color: #888;">"""Provider name (e.g., 'openai', 'anthropic')."""</span>
<span style="color: cyan;">@property</span>
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">capabilities</span>(<span style="color: cyan;">self</span>) -> ProviderCapabilities: ...
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">model_id</span>(<span style="color: cyan;">self</span>) -> <span style="color: cyan;">str</span>: ...
<span style="color: #888;">"""Model identifier (e.g., 'gpt-4o', 'claude-3-5-sonnet-20241022')."""</span>
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">create_chat_model</span>(
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">generate_changes</span>(
<span style="color: cyan;">self</span>,
model: <span style="color: cyan;">str</span>,
temperature: <span style="color: cyan;">float</span> = <span style="color: yellow;">0.7</span>,
**kwargs,
) -> BaseChatModel: ...
project: Project,
plan: Plan,
contexts: list[Context],
actor_context: ActorInvocationContext | None = None,
progress_callback: Callable[[int], None] | None = None,
) -> ProviderResponse: ...
<span style="color: #888;">"""Generate code changes based on the plan and context."""</span>
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">create_embedding_model</span>(
<span style="color: magenta; font-weight: 600;">def</span> <span style="color: cyan; font-weight: 600;">stream_changes</span>(
<span style="color: cyan;">self</span>,
model: <span style="color: cyan;">str</span>,
**kwargs,
) -> BaseEmbeddings: ...
project: Project,
plan: Plan,
contexts: list[Context],
actor_context: ActorInvocationContext | None = None,
progress_callback: Callable[[int], None] | None = None,
) -> Iterator[dict[str, object]]: ...
<span style="color: #888;">"""Stream workflow events while generating changes.
Yields dicts keyed by workflow node name. Finishes with a
``"__end__"`` event containing a ``ProviderResponse`` under
the ``response`` key.
"""</span>
</code></pre></div>
#### Custom Resource Types