New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@oramacloud/ai-sdk-provider

Package Overview
Dependencies
Maintainers
9
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oramacloud/ai-sdk-provider

Orama provider for Vercel AI SDK

0.1.3
latest
npm
Version published
Maintainers
9
Created
Source

AI SDK Orama Provider

A provider for Vercel's AI SDK that enables seamless integration with Orama's search and chat capabilities.

Features

  • 🔍 Full-text, vector, and hybrid search
  • 💬 Streaming chat/QA functionality
  • 🚀 Framework agnostic
  • 🔄 Real-time streaming responses

Installation

npm install @oramacloud/ai-sdk-provider

Usage

Configuration

// Create an Orama provider instance
const provider = oramaProvider({
  // Required configurations
  endpoint: process.env.ORAMA_API_URL,
  apiKey: process.env.ORAMA_API_KEY,
  // Optional configurations
  userContext?: string | Record<string, any>;  // Context for QA sessions
  inferenceType?: "documentation";  // Currently only supports "documentation"
  searchMode?: "fulltext" | "vector" | "hybrid";  // Default: "fulltext"
  searchOptions?: OramaSearchOptions;  // Additional search parameters
})

Search Options

interface OramaSearchOptions {
  mode?: "fulltext" | "vector" | "hybrid";
  where?: Record<string, any>;
  sortBy?: Array<{ property: string; order?: "asc" | "desc" }>;
  facets?: Record<string, any>;
  limit?: number;
  boost?: Record<string, number>;
  order?: "asc" | "desc";
}

Chat/QA Usage

import { streamText } from 'ai';
const response = await streamText({
  model: provider.ask(),
  messages: [{ 
    role: 'user', 
    content: 'What is vector search?' 
  }]
});

Search Usage

const response = await generateText({
  model: provider.search(),
  messages: [{ 
    role: 'user', 
    content: 'vector search documentation' 
  }]
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

Apache 2.0. Read the full license here

FAQs

Package last updated on 24 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts