For the complete documentation index, see llms.txt. This page is also available as Markdown.

Model API guide

Model Guide for you to implement FLock model

Pre-requirement

Manual creation via website

Technology Stack

  • TypeScript

  • JavaScript

API Call example

Conversational Rag Chat

post

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
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 .env file in the root directory or in your existing env file, add the followings:

Step by Step guide

  • Create a flockModel.ts

  • Create a async/await function flockModel wrapping the API call

    • use axios.post method for request

    • We will pass two parameters

      • question

      • knowledge_source_id

    • get the response of the call

    • We chose to use try/catch to handle any error during the call to debug the process.

Last updated

Was this helpful?