feat: LLM chat backend with tool-use loop and AG-UI streaming#26
Draft
cdgaete wants to merge 1 commit into
Draft
feat: LLM chat backend with tool-use loop and AG-UI streaming#26cdgaete wants to merge 1 commit into
cdgaete wants to merge 1 commit into
Conversation
89b5f84 to
375f07e
Compare
Adds the AI integration backend on top of upstream PyPSA: feature-flagged chat service using LiteLLM, AG-UI SSE streaming, tool-use loop with three network analysis tools (list_networks, get_network_detail, get_network_statistics), Network.is_solved/objective surfacing, and the `pypsa_app.llm` package wiring. This is a re-baselining of dev-llm onto upstream PyPSA/pypsa-app main. The pre-reset history is preserved at tag archive/main-pre-reset-2026-05-22.
fbf4748 to
35ae6a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an LLM chat backend to pypsa-app with provider-agnostic configuration (OpenRouter, Ollama, or any OpenAI-compatible API).
What's included
llm/package: LiteLLM client, chat service with multi-step tool-use loop, AG-UI SSE event streaming, system promptslist_networks,get_network_detail,get_network_statisticsPOST /chat/stream(SSE),GET /chat/healthLLMSettings: provider-agnostic config via env vars (LLM_PROVIDER,LLM_API_KEY,LLM_API_BASE,LLM_MODEL)CHAT_ENABLEDwired through/versionendpointlitellm>=1.83added topyproject.tomlNot included (future PRs)