This repository provides the Silverhand, an end-to-end solution leveraging state-of-the-art AI frameworks to automate and refine application writing. It orchestrates specialized legal, ethical, and essay-review agents using Microsoft’s AutoGen multi-agent framework, combines a Retrieval-Augmented Generation (RAG) pipeline with PostgreSQL/pgvector for contextual document retrieval, and exposes a robust REST API with FastAPI and Pydantic models. A Streamlit front-end offers a user-friendly interface, and the entire stack is containerized via Docker for seamless deployment.
A demo video of this application.
-
Multi-Agent Orchestration
Utilizes Microsoft AutoGen to define and coordinate multiple AI agents (e.g., legal, ethical, essay-review agents) in a conversation framework for iterative content refinement. -
Retrieval-Augmented Generation (RAG) Pipeline
Implements a RAG workflow to ingest, split, embed, and retrieve document chunks, ensuring responses are grounded in relevant source material. -
Vector Embeddings with pgvector
Stores and queries high-dimensional embeddings in PostgreSQL via the pgvector extension, interfaced through LangChain’s vectorstore abstraction for efficient similarity search. -
FastAPI-Powered REST API
Exposes endpoints for document upload, agent orchestration, and retrieval operations using FastAPI’s OpenAPI-based auto-documentation (Swagger UI) and Pydantic data validation. -
Streamlit Front-End
Provides an interactive web application built with Streamlit for users to submit requests, view agent dialogues, and download refined application drafts. -
Semantic Text Splitting
Includes aSemanticChunkerthat adaptively segments large documents based on embedding similarity, maximizing retrieval precision and contextual coherence. -
Containerized Deployment
Encapsulates the entire toolchain within Docker containers for consistent development, testing, and production environments. -
OpenAI API Integration
Leverages the OpenAI Embeddings and Chat Completion APIs to generate and refine text with context-aware LLM calls.
-
Agent Layer
- AutoGen Agents: Define roles (e.g., “EssayReviewerAgent”, “EthicsAgent”) to iteratively critique and refine draft sections.
- Conversation Orchestration: Automate message flow among agents to converge on high-quality content.
-
RAG Pipeline
- Ingestion & Chunking: Documents are split using
SemanticChunker, producing semantically cohesive chunks. - Embedding & Storage: Each chunk is embedded via OpenAI API and stored in PostgreSQL/pgvector.
- Retrieval: On query, top-k relevant chunks are fetched and provided as context to the LLM.
- Ingestion & Chunking: Documents are split using
-
API Layer
- FastAPI Endpoints: Include
/upload,/generate, and/retrieveroutes, documented via Swagger UI for ease of integration. - Data Models: Enforced with Pydantic for robust request/response schemas.
- FastAPI Endpoints: Include
-
Front-End
- Streamlit App: Offers file upload widgets, real-time progress logs, and download links for final essay drafts.
-
Deployment
- Docker Compose: Defines services for the API, database, and front-end.
- Scaling: Easily extendable for distributed agent execution and database replication.
-
Prerequisites
- OpenAI API key;
- At least 25 GB available local disk storage for docker images;
- At least 24 GB available RAM;
-
Clone & Configure
git clone https://github.com/samplecatalina/silverhand.git cd silverhand # Set OPENAI_API_KEY and database credentials in ./config/.env
-
Build & Run
Run the following from the root directory.docker compose up --build
Once the application has started up, navigate to:
http://localhost:8501/
If you want to completely clean up your application stack and start fresh after you finished using the application, run the following:
docker compose down -
Access
- API docs: http://localhost:8000/docs
- Streamlit UI: http://localhost:8501
- Upload Documents: Use the
/uploadendpoint or the Streamlit interface to add your essay background materials. - Generate Draft: Call
/generatewith parameters (e.g., target funder, organization details) to initiate the multi-agent workflow. - Retrieve Context: Use
/retrieveto fetch specific sections or agent critiques. - Download Output: The Streamlit app provides links to download the final, polished essay application.
This project is licensed under the MIT License.




