This project creates API endpoints which enables users to chat with or ask questions based on supplied text/knowledge.
The application makes use of LangChain langchaingo to communicate with LLMs and facilitate RAG.
To install and run the project, follow these steps:
-
Clone the repository:
git clone https://github.com/Naadborole/TextRAGApi.git cd TextRAGApi -
Start the server:
go run .
Once the server is running, you can interact with the API endpoints using tools like curl, Postman, or any HTTP client of your choice.
Endpoint: /embedAndStore
Method: POST
Description: Embed the uploaded text and store it for retrieval.
Request Body:
{
"text": "Your text data here."
}Response:
{
"ID": "1097108e-49b0-4e65-a931-9b2a91f1d1da"
}Endpoint: /queryDoc
Method: POST
Description: Query the stored documents based on the input text.
Request Body:
{
"text": "Your query here."
}Response:
{
"results": [
{
"document": "Relevant document text.",
"score": 0.95
},
...
]
}Endpoint: /queryChat
Method: POST
Description: Chat with the system based on the input query, using RAG for generating responses.
Request Body:
{
"query": "Your query here."
}Response:
{
"Generated response based on the input query."
}