talhaanwarch / doc_chat

Create a production level scalable chat bot to respond from the fed data
https://gptdemo.talhaanwar.com/
1 stars 0 forks source link

I couldn't get it to work #8

Closed joebordes closed 1 year ago

joebordes commented 1 year ago

I tried running it "as is" without the docker container. I received a positive response to doc_ingestion but I saw no changes in the milvus DB.

query had no context in the prompt so no answer

then I tried with docker and got the same result

talhaanwarch commented 1 year ago

Can you please share the curl command. Without docker, I tried the following

curl -X 'POST' \
  'http://localhost:8000/doc_ingestion' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "dir_path": "../data",
  "embeddings_name": "openai",
  "collection_name": "test1",
  "drop_existing_embeddings": false
}'

and here is test1 collection in milvusDB image Here is query endpoint

curl -X 'POST' \
  'http://localhost:8000/query' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "What is CNN?",
  "session_id": "5929311e-adbe-4fd4-9fb0-b8f0459603eb",
  "llm_name": "openai",
  "collection_name": "test1"
}'

Response

{
  "answer": "CNN stands for Convolutional Neural Network, which is a type of artificial neural network used in computer vision for tasks such as object detection, segmentation, and image recognition. It has the ability to learn hierarchical representations of input images and can generalize new data, but has drawbacks such as lengthy training time, the need for large labeled data sets, and susceptibility to overfitting. Despite these limitations, CNNs are still widely used and effective in computer vision.",
  "cost": {
    "successful_requests": 1,
    "total_cost": 0.0008139999999999999,
    "total_tokens": 407,
    "prompt_tokens": 316,
    "completion_tokens": 91
  },
  "source": [
    "../data/3.txt"
  ]
}

I will also push the text file in data folder, so you can test.

talhaanwarch commented 1 year ago

In the updated version. Try this

{
  "urls": ["https://raw.githubusercontent.com/talhaanwarch/doc_chat_api/main/data/0.txt", 
        "https://raw.githubusercontent.com/talhaanwarch/doc_chat_api/main/data/1.txt"],
  "embeddings_name": "openai",
  "collection_name": "test2",
  "drop_existing_embeddings": false
}