@groo.dev/ai-core
v0.0.3
Published
Core SDK for Groo AI - chat and search APIs
Readme
@groo.dev/ai-core
Core SDK for Groo AI - chat and search APIs.
Installation
npm install @groo.dev/ai-coreUsage
Chat Client
The chat client uses the OpenAI SDK for streaming responses:
import { createChatClient } from '@groo.dev/ai-core'
const chat = createChatClient('your-project-id')
const stream = await chat.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello!' }],
stream: true,
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '')
}Search Client
import { createSearchClient } from '@groo.dev/ai-core'
const search = createSearchClient('your-project-id')
const results = await search.search('how to get started', { limit: 5 })Combined Client
import { createGrooClient } from '@groo.dev/ai-core'
const groo = createGrooClient('your-project-id')
// Use chat
const stream = await groo.chat.chat.completions.create({...})
// Use search
const results = await groo.search('query')Options
createChatClient('project-id', {
apiUrl: 'https://custom-api.example.com', // Optional custom API URL
})License
MIT
