How pavanku7/promt-eng-using-streamlit works
Project Type and Purpose
• This is an open-source, single-page Streamlit application (“tool-for-prompt-research”) whose goal is to help researchers craft, test, and store prompts against an LLM (IBM BAM or watsonx).
• The user interacts via a browser UI, the app orchestrates prompt generation, calls an external API, processes or parses returned data, and saves results locally.
Top Level Architecture Components
a. Streamlit UI Layer (src/main.py)
• Renders the web interface, collects user inputs (prompt text, options).
• Submits user actions into the backend controllers.
b. Core Business Logic
• language_model.py: wraps calls to the external LLM endpoints (BAM or watsonx).
• StoryCreation.py & dmb_sample.py: generate or format prompts (templates, story scaffolds).
• svg_parser.py: post-processes any SVG outputs or parses diagrammatic responses.
• save_results.py: handles persistence (writes JSON or text files under a results folder).
c. External Services
• IBM BAM or watsonx REST API (configured via .env).
d. Local File System
• Configuration (.env)
• requirements.txt for dependencies
• src/story_generator.txt, src/struts_*.txt as prompt templates
• Output folder (not committed) or local storage for result files
Interactions and Data Flow
• User → Streamlit UI: selects or enters prompt parameters.
• UI → Controller (main.py): calls business-logic modules.
• Controller → language_model: constructs API request (with API key and URL).
• language_model ↔ External LLM API: sends prompt, retrieves response.
• Controller → Processors (StoryCreation, svg_parser, dmb_sample) to refine or extract structure.
• Controller → save_results: writes output to disk.
• save_results → User: offers download link or displays saved results in UI.
Architectural Patterns & Design Principles
• Separation of Concerns: UI layer vs. service layer vs. data persistence layer.
• Modularization: each core function (prompt generation, API client, parsing, storage) lives in its own module.
• Configuration-driven: external service endpoints and keys live in env vars.
• Extensibility: new prompt templates or processors can be added by dropping a new .txt and wiring into main.py.