Skip to main content

Creating RAG application

Create RAG application with a single API call using AI Spaceship

Getting Started

You can build an AI Chatbot with a simple API call. You can use, curl, postman, typescript, python, or any language of your choice. We'll show examples from Curl, Typescript and Python.

Creating RAG application

Create an API Key by logging into your account.

You can see “API Keys” at the header highlighted in yellow background colour.

Curl

You can use curl to create a project and get a project id.

curl -X POST https://api.aispaceship.io/projects \
-H "x-ais-apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com/page1", "https://example.com/page2"]}'

Typescript / Javascript

fetch("https://api.aispaceship.io/projects", {
method: "POST",
headers: {
"x-ais-apikey": "YOUR_API_KEY",
},
body: JSON.stringify({
urls: ["https://example.com/page1", "https://example.com/page2"],
}),
});

Python

import requests

headers = {
"x-ais-apikey": "YOUR_API_KEY"
}

response = requests.post("https://api.aispaceship.io/chatbots/:chatbotId/:contextId/search-stream?query={your-query}",
headers=headers, json={"urls": ["https://example.com/page1", "https://example.com/page2"]})
print(response.json())

Querying

You can query your RAG application with a simple API call. You can use, curl, postman, typescript, python, or any language of your choice. We'll show examples from Curl, Typescript and Python.

Curl

curl -X POST https://api.aispaceship.io/projects/:projectId/:contextId/search-stream?query={your-query} \
-H "x-ais-apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \

Typescript / Javascript

fetch(
"https://api.aispaceship.io/projects/:projectId/:contextId/search-stream?query={your-query}",
{
method: "GET",
headers: {
"x-ais-apikey": "YOUR_API_KEY",
},
}
);

Python

import requests

headers = {
"x-ais-apikey": "YOUR_API_KEY"
}

response = requests.get("https://api.aispaceship.io/projects/:projectId/:contextId/search-stream?query={your-query}",
headers=headers)
print(response.json())