Installation
- JavaScript
- Python
Configuration
Point the SDK to GAIA:- JavaScript
- Python
Usage
Use your project ID as the model:- JavaScript
- Python
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Using OpenAI SDK with GAIA
npm install openai
pip install openai
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'http://localhost:3000/api/v1',
apiKey: 'gaia_your_api_key'
});
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:3000/api/v1",
api_key="gaia_your_api_key"
)
const completion = await client.chat.completions.create({
model: "proj_abc123", // your GAIA project ID
messages: [
{ role: "user", content: "What's in my knowledge base?" }
]
});
console.log(completion.choices[0].message.content);
completion = client.chat.completions.create(
model="proj_abc123",
messages=[
{"role": "user", "content": "What's in my knowledge base?"}
]
)
print(completion.choices[0].message.content)
const stream = await client.chat.completions.create({
model: "proj_abc123",
messages: [{ role: "user", content: "Hello!" }],
stream: true
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
