Model API guide
Model Guide for you to implement FLock model
Pre-requirement
Manual creation via website
Generate API Key via Acquiring the API Key
Create Model via Model Customisation
Technology Stack
TypeScript
JavaScript
API Call example
RAG chat with a conversation history.
Authorizations
x-api-keystringRequired
Body
questionstringRequired
chat_historyany ofOptionalDefault:
[]or
knowledge_source_idstringRequired
Responses
200
Successful Response
application/json
answerstringRequired
generated_questionstringRequired
422
Validation Error
application/json
post/chat/conversational_rag_chat
POST /chat/conversational_rag_chat HTTP/1.1
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 74
{
"question": "text",
"chat_history": [
[
"text"
]
],
"knowledge_source_id": "text"
}{
"answer": "text",
"source_docs": [
[]
],
"generated_question": "text"
}How it Works
Setup
Package installation
.env
Create an
.envfile in the root directory or in your existing env file, add the followings:
Step by Step guide
Create a
flockModel.tsCreate a
async/awaitfunctionflockModelwrapping the API calluse
axios.postmethod for requestWe will pass two parameters
questionknowledge_source_id
get the response of the call
We chose to use
try/catchto handle any error during the call to debug the process.
Last updated
Was this helpful?