Skip to content

Commit 1181072

Browse files
committed
feat: Adds sample data to default setup
1 parent 67ebb71 commit 1181072

File tree

5 files changed

+52
-11
lines changed

5 files changed

+52
-11
lines changed

‎.env.sample‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PORT=8000
22
OPENAI_API_KEY=
33
VERBOSE_LLM=True
4-
DIALOG_DATA_PATH=./know.csv
5-
PROJECT_CONFIG=./prompt.toml
4+
DIALOG_DATA_PATH=./sample_data/data.csv
5+
PROJECT_CONFIG=./sample_data/prompt.toml
66
DATABASE_URL=postgresql://talkdai:talkdai@127.0.0.1:5432/talkdai
77
STATIC_FILE_LOCATION=static
88
DEBUG=false

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,6 @@ requirements.txt
164164
*.csv
165165
*.toml
166166
!src/tests/fixtures/*.csv
167-
!src/tests/fixtures/*.toml
167+
!src/tests/fixtures/*.toml
168+
!sample_data/*.csv
169+
!sample_data/*.toml

‎README.md‎

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,45 @@ We assume you are familiar with [Docker](https://www.docker.com/), if you are no
1717
```bash
1818
docker-compose up
1919
```
20-
it will start two services:
20+
it will start two services:
2121
- `db`: where the PostgresSQL database runs to support chat history and document retrieval for [RAG](https://en.wikipedia.org/wiki/Prompt_engineering#Retrieval-augmented_generation);
2222
- `dialog`: the service with the api.
2323

2424
## Quick Start
2525

26-
To use this project, you need to have a `.csv` file with the knowledge base and a `.toml` file with your prompt configuration.
26+
If you are new to the project and want to get started quickly with some sample data and a simple prompt configuration, follow the steps below:
2727

28-
We recommend that you create a folder inside this project called `data` and put CSVs and TOMLs files over there.
28+
1. Clone the repository:
2929

30-
### `.csv` knowledge base
30+
```bash
31+
git clone https://github.com/talkdai/dialog.git
32+
```
33+
34+
2. Create a `.env` file based on the `.env.sample` file:
35+
36+
```bash
37+
cp .env.sample .env
38+
```
39+
40+
3. Set the OPENAI_API_KEY value in the `.env` file:
41+
42+
```
43+
OPENAI_API_KEY=your-openai-api-key
44+
```
45+
46+
4. Build and start the services with docker:
47+
48+
```bash
49+
docker-compose up --build
50+
```
51+
52+
### Customizing prompts and data
53+
54+
To customize this project, you need to have a `.csv` file with the knowledge base of your interest and a `.toml` file with your prompt configuration.
55+
56+
We recommend that you create a folder inside this project called `data` to store your CSVs and TOMLs files over there. The `data` folder is already in the `.gitignore` file, so you can store your data without worrying about it being pushed to the repository.
57+
58+
#### `.csv` knowledge base
3159

3260
The knowledge base has needed columns:
3361

@@ -43,12 +71,12 @@ category,subcategory,question,content
4371
faq,promotions,loyalty-program,"The company XYZ has a loyalty program when you refer new customers you get a discount on your next purchase, ..."
4472
```
4573

46-
When the `dialog` service starts, it loads the knowledge base into the database, so make sure the database is up and paths are correct (see [environment variables](##environment-variables) section). Alternatively, inside `src` folder, run `make load-data path="<path-to-your-knowledge-base>.csv"`.
74+
When the `dialog` service starts, it loads the knowledge base into the database, so make sure the database is up and paths are correct (see [environment variables](##environment-variables) section). Alternatively, inside `src` folder, run `make load-data path="<path-to-your-knowledge-base>.csv"`.
4775

48-
See [our documentation](https://dialog.talkd.ai/settings#csv-knowledge-base) for more options about the the knowledge base, including embedding more coluns together.
76+
See [our documentation](https://dialog.talkd.ai/settings#csv-knowledge-base) for more options about the the knowledge base, including embedding more columns together.
4977

5078

51-
### `.toml` prompt configuration
79+
#### `.toml` prompt configuration
5280

5381
The `[prompt.header]`, `[prompt.suggested]`, and `[fallback.prompt]` fields are mandatory fields used for processing the conversation and connecting to the LLM.
5482

@@ -69,7 +97,7 @@ qualified service to high-end customers. Be brief in your answers, without being
6997
and objective in your responses. Never say that you are a model (AI), always answer as Avelino.
7098
Be polite and friendly!"""
7199

72-
suggested = "Here is some possible content
100+
suggested = "Here is some possible content
73101
that could help the user in a better way."
74102

75103
fallback = "I'm sorry, I couldn't find a relevant answer for your question."

‎sample_data/data.csv‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
category,subcategory,question,content
2+
faq,football,"Whats your favorite soccer team","My favorite soccer team is Palmeiras, from Brazil."
3+
faq,football,"Whats your favorite soccer player","My favorite soccer player is Neymar, from Brazil."

‎sample_data/prompt.toml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[model]
2+
model_name = "gpt-4o"
3+
temperature = 0.1
4+
5+
[prompt]
6+
prompt = """
7+
You are a nice bot, say something nice to the user and try to help him with his question, but also say to the user that you don't know totally about the content he asked for.
8+
"""

0 commit comments

Comments
 (0)