Question & Answer API
Allows to query the knowledge base using a specific AI model.
The Knowledge Base model
Section titled “The Knowledge Base model”Properties
Section titled “Properties”- id
String- The unique identifier for the knowledge base which is given by Pingstreams. - name
String- The knowledge base name. - id_project
String- The unique identifier of the project - preview_settings
Object- The settings for the knowledge base preview - default
Boolean- Specify if the knowledge base is the default one
Ask the Knowledge Base
Section titled “Ask the Knowledge Base”POST https://api.pingstreams.com/v3/:project_id/kb/qaAllows to query the knowledge base using a specific AI model.
Path Parameters
Section titled “Path Parameters”- project_id
string- The Project Id is a unique code assigned to your project when you create it in Pingstreams.
Headers
Section titled “Headers”- Authorization
string- Authorization token. Basic Auth or JWT
Request Body
Section titled “Request Body”- question
string- The question submitted - namespace
string- The id of the Knowledge Base in which to search for the answer - model
string- The model to use to generate the response (e.g. gpt-4o) - system_context
string- (Optional) The context to give to the AI to shape its behavior in generating the response. - max_tokens
Number- The maximum number of tokens that can be consumed to generate the response - temperature
Number- defines creativity in generating responses (low values determine more specific and predictable responses) - top_k
Number- The number of nearby chunks to use to generate the response
Response
Section titled “Response”{
"answer": "To create an AI assistant using OpenAI, you can follow these steps:\n\n1. **Visit OpenAI**: Navigate to the OpenAI website.\n2. **Access the API Section**:\n - Go to 'Products', then select 'API'.\n - Log in and select 'API'.\n3. **Navigate to Assistant Creation**:\n - Ensure you are on the Dashboard.\n - Click on 'Assistant' from the left sidebar menu.\n4. **Create the Assistant**:\n - Click the green 'Create' button in the top right corner.\n - Name your assistant and provide context in the 'Instructions' section to fine-tune its responses.\n5. **Select the Model**:\n - For this example, you can use GPT-4o.\n6. **Handle File Formats**:\n - If uploading a CSV file, use a Code interpreter.\n - For PDF or text files, use the File Search feature.\n7. **Integrate with Pingstreams**:\n - Copy the assistant ID.\n - Go to the Pingstreams dashboard, click on the block where the ChatGPT Assistant is placed.\n - In the right-side menu, paste the assistant ID into the \"Assign GPT Assistant\" field.\n\nIf you need",
"success": true,
"namespace": "66a897133eaa7f0013632c5b",
"id": "66b6268722af86ab6a739cb6",
"ids": [
"66b6268722af86ab6a739cb6"
],
"source": "https://gethelp.pingstreams.com/articles/create-an-ai-assistant-in-openai/",
"sources": [
"https://gethelp.pingstreams.com/articles/create-an-ai-assistant-in-openai/"
],
"content_chunks": null,
"prompt_token_size": 1185,
"error_message": null,
"chat_history_dict": {
"0": {
"question": "how can i create an AI assistant?",
"answer": "To create an AI assistant using OpenAI, you can follow these steps:\n\n1. **Visit OpenAI**: Navigate to the OpenAI website.\n2. **Access the API Section**:\n - Go to 'Products', then select 'API'.\n - Log in and select 'API'.\n3. **Navigate to Assistant Creation**:\n - Ensure you are on the Dashboard.\n - Click on 'Assistant' from the left sidebar menu.\n4. **Create the Assistant**:\n - Click the green 'Create' button in the top right corner.\n - Name your assistant and provide context in the 'Instructions' section to fine-tune its responses.\n5. **Select the Model**:\n - For this example, you can use GPT-4o.\n6. **Handle File Formats**:\n - If uploading a CSV file, use a Code interpreter.\n - For PDF or text files, use the File Search feature.\n7. **Integrate with Pingstreams**:\n - Copy the assistant ID.\n - Go to the Pingstreams dashboard, click on the block where the ChatGPT Assistant is placed.\n - In the right-side menu, paste the assistant ID into the \"Assign GPT Assistant\" field.\n\nIf you need"
}
}
}Example
Section titled “Example”curl -v -X POST -u user@example.com:password \
-d '{"question":"how can i create an AI assistant?","namespace":"66a897133eaa7f0013632c5b","model":"gpt-4o","temperature":0.7,"max_tokens":256,"top_k":4,"system_context":null}' \
https://api.pingstreams.com/v3/63ad512e70d5ed0012ad6286/kb/qa