Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,46 +1,4 @@
|
|
| 1 |
-
title: Logbert Rca
|
| 2 |
-
emoji: 🌖
|
| 3 |
-
colorFrom: pink
|
| 4 |
-
colorTo: pink
|
| 5 |
-
sdk: docker
|
| 6 |
-
pinned: false
|
| 7 |
-
|
| 8 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
# RCA SQL Agent
|
| 13 |
-
|
| 14 |
-
This project is an intelligent SQL agent that uses LangChain and Hugging Face SLM to generate and execute SQL queries on a PostgreSQL database.
|
| 15 |
|
| 16 |
-
## Features
|
| 17 |
-
- Natural language to SQL query generation using Hugging Face SLM via LangChain
|
| 18 |
-
- Executes generated queries on a PostgreSQL database
|
| 19 |
-
- Returns results to the user
|
| 20 |
-
|
| 21 |
-
## Setup
|
| 22 |
-
1. Install dependencies:
|
| 23 |
-
```bash
|
| 24 |
-
pip install langchain[all] psycopg2-binary transformers langchain-huggingface
|
| 25 |
-
```
|
| 26 |
-
2. Set your PostgreSQL connection details in environment variables or update the script:
|
| 27 |
-
- `PG_HOST`, `PG_PORT`, `PG_USER`, `PG_PASSWORD`, `PG_DATABASE`
|
| 28 |
-
3. Set your Hugging Face configuration in your environment (e.g., in a `.env` file):
|
| 29 |
-
- `HUGGINGFACEHUB_API_TOKEN` — your Hugging Face access token ([get one here](https://huggingface.co/settings/tokens))
|
| 30 |
-
- `HUGGINGFACE_MODEL` — the model repo id (e.g., `distilgpt2`, `microsoft/phi-2`, etc.)
|
| 31 |
-
- Optionally, set `HF_CACHE_DIR` for local model cache.
|
| 32 |
-
|
| 33 |
-
## Usage
|
| 34 |
-
Run the agent script and enter your question in natural language. The agent will generate and execute the SQL query, then display the results.
|
| 35 |
-
|
| 36 |
-
```bash
|
| 37 |
-
python sql_agent.py
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
Type your question (e.g., "How many users signed up last month?") and get the result from your Postgres database.
|
| 41 |
-
|
| 42 |
-
---
|
| 43 |
-
---
|
| 44 |
title: Rca Sqlagent
|
| 45 |
emoji: 👀
|
| 46 |
colorFrom: yellow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
title: Rca Sqlagent
|
| 3 |
emoji: 👀
|
| 4 |
colorFrom: yellow
|