https://github.com/korpog/firstchain
REST API using RAG
https://github.com/korpog/firstchain
fastapi langchain openai-api
Last synced: about 1 year ago
JSON representation
REST API using RAG
- Host: GitHub
- URL: https://github.com/korpog/firstchain
- Owner: korpog
- Created: 2025-01-21T20:38:19.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-03T22:23:21.000Z (over 1 year ago)
- Last Synced: 2025-02-03T22:24:22.324Z (over 1 year ago)
- Topics: fastapi, langchain, openai-api
- Language: Python
- Homepage:
- Size: 604 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 1. What is this?
REST API created with FastAPI, OpenAI API and LangChain (for RAG). Ask questions concerning David Hume's *A Treatise of Human Nature*.
App performs semantic search on the book and using retrieved context pieces generates answers to your questions.
## 2. How to run
Clone/download this repository and create .env file in project directory. It should look like this
```
ENVIRONMENT = "production" (or "development")
OPENAI_API_KEY="your_key"
MODEL_TEMPERATURE = 0.3
AUTH_SECRET_KEY = "auth_secret_key" (use 'openssl rand -hex 32' to generate)
LANGCHAIN_API_KEY="your_key"
LANGCHAIN_TRACING_V2="true"
```
### 2.1 Without Docker [on Linux]
Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
Open terminal in your project directory and run the following command
```uv run -- fastapi run src/main.py```
### 2.2 With Docker
In your project directory:
```docker build -t firstchain .```
```docker run --env-file .env -p 8000:8000 firstchain```
