How atharva557/prompt-chaining works
PromptChain combines a Streamlit two-model workflow—task entry, prompt drafting and human review, code generation, refinement, and saving—with a reusable model-management library and MCP server. The graph preserves README-described capabilities such as chats, presets, profiles, history, and model discovery. Some connections are documented by the README or SOURCE INDEX rather than sampled call sites; unsampled internals are not inferred beyond those references.
Main entry points: app.py App workflow · api.py App API facade · manager.py Model manager · streaming.py Generation streaming
Components 27
Streamlit app
- App workflow
app.py - Task and presets
ui/task_input.py - Prompt review
ui/prompt_review.py - Code output
ui/code_output.py - Direct chats
ui/chat.py - Settings
ui/settings.py - Landing page
ui/landing.py - UI styling
ui/styles.py
App support
- Configuration and profiles
core/config.py - Run history
core/history.py - Preset suggestions
core/suggest.py - Built-in presets
presets/presets.json - App API facade
core/api.py - App streaming adapter
core/streaming.py
Model control
- Model manager
src/promptchain/manager.py - Endpoint definitions
src/promptchain/endpoint.py - Endpoint persistence
src/promptchain/endpoints_file.py - Model lifecycle
src/promptchain/lifecycle.py - Model discovery
src/promptchain/discovery.py - Generation streaming
src/promptchain/streaming.py - Token and cost estimates
src/promptchain/costs.py
Backends and MCP
- Backend registry
src/promptchain/backends.py - MCP server
src/promptchain/mcp_server.py
Other components
- User
- Local model servers
- Cloud model APIs
- Coding agent
Connections 46
- User → App workflow: uses
README.md - App workflow → Task and presets: renders
app.py - App workflow → Prompt review: renders
app.py - App workflow → Code output: renders
app.py - App workflow → Direct chats: routes to
app.py - App workflow → Settings: renders
app.py - App workflow → Landing page: renders
app.py - App workflow → UI styling: uses
app.py - App workflow → Configuration and profiles: loads
app.py - App workflow → Run history: reads
app.py - Task and presets → Preset suggestions: requests suggestions
ui/task_input.py - Task and presets → Configuration and profiles: updates profiles
ui/task_input.py - Task and presets → Built-in presets: uses presets
README.md - App workflow → App API facade: calls
app.py - App workflow → App streaming adapter: calls
app.py - App API facade → Backend registry: re-exports
core/api.py - App API facade → Model discovery: re-exports
core/api.py - App API facade → Model lifecycle: re-exports
core/api.py - App API facade → Generation streaming: re-exports
core/api.py - App API facade → Token and cost estimates: re-exports
core/api.py - App streaming adapter → Generation streaming: delegates to
core/streaming.py - Code output → App API facade: uses
ui/code_output.py - Direct chats → App API facade: uses
ui/chat.py - Direct chats → App streaming adapter: uses
ui/chat.py - Settings → App API facade: uses
ui/settings.py - Settings → Configuration and profiles: uses
ui/settings.py - Model manager → Model lifecycle: manages
src/promptchain/manager.py - Model manager → Endpoint definitions: uses
src/promptchain/manager.py - Model manager → Generation streaming: streams via
src/promptchain/manager.py - Model manager → Token and cost estimates: estimates costs
src/promptchain/manager.py - Endpoint definitions → Backend registry: uses
src/promptchain/endpoint.py - Endpoint persistence → Endpoint definitions: loads and saves
src/promptchain/endpoints_file.py - Endpoint persistence → Model manager: configures
src/promptchain/endpoints_file.py - Model discovery → Backend registry: uses
src/promptchain/discovery.py - Model lifecycle → Backend registry: uses
src/promptchain/lifecycle.py - Generation streaming → Backend registry: uses
src/promptchain/streaming.py - Model discovery → Local model servers: queries models
src/promptchain/discovery.py - Model discovery → Cloud model APIs: queries models
src/promptchain/discovery.py - Model lifecycle → Local model servers: loads and unloads
src/promptchain/lifecycle.py - Generation streaming → Local model servers: streams requests
src/promptchain/streaming.py - Generation streaming → Cloud model APIs: streams requests
src/promptchain/streaming.py - Coding agent → MCP server: invokes tools
README.md - MCP server → Model manager: controls models
src/promptchain/mcp_server.py - MCP server → Model lifecycle: calls
src/promptchain/mcp_server.py - MCP server → Model discovery: calls
src/promptchain/mcp_server.py - MCP server → Endpoint persistence: uses
src/promptchain/mcp_server.py