Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oramacloud/ai-sdk-provider

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oramacloud/ai-sdk-provider - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

31

dist/index.d.ts
import { OramaClient } from '@oramacloud/client';
import { LanguageModelV1 } from '@ai-sdk/provider';

@@ -20,12 +21,2 @@ interface OramaProviderConfig {

}
interface SearchResult {
text: string;
results?: any;
finishReason: string;
usage: {
promptTokens: number;
completionTokens: number;
totalTokens: number;
};
}

@@ -36,21 +27,3 @@ declare class OramaService {

constructor(config: OramaProviderConfig);
ask(): {
doGenerate: (prompt: any) => Promise<SearchResult | undefined>;
doStream: (prompt: any) => Promise<{
stream: ReadableStream<any>;
response: Promise<{
id: string;
created: number;
model: string;
usage: {
promptTokens: any;
completionTokens: number;
totalTokens: any;
};
}>;
data: Promise<{
id: string;
}>;
}>;
};
ask(): LanguageModelV1;
}

@@ -57,0 +30,0 @@

55

dist/index.js

@@ -41,2 +41,6 @@ "use strict";

return {
specificationVersion: "v1",
provider: "orama",
modelId: "orama-default",
defaultObjectGenerationMode: "json",
doGenerate: async (prompt) => {

@@ -54,3 +58,2 @@ const promptText = prompt.prompt?.[0]?.content?.[0]?.text || prompt;

text: "No results found.",
results: [],
finishReason: "stop",

@@ -61,3 +64,9 @@ usage: {

totalTokens: promptText.length + "No results found.".length
}
},
toolCalls: void 0,
functionCall: void 0,
logprobs: void 0,
systemFingerprint: void 0,
choices: [],
rawCall: {}
};

@@ -74,3 +83,2 @@ }

text: formattedText,
results: searchResults,
finishReason: "stop",

@@ -81,3 +89,9 @@ usage: {

totalTokens: promptText.length + formattedText.length
}
},
toolCalls: void 0,
functionCall: void 0,
logprobs: void 0,
systemFingerprint: void 0,
choices: [],
rawCall: {}
};

@@ -89,2 +103,17 @@ } catch (error) {

}
return {
text: "",
finishReason: "stop",
usage: {
promptTokens: promptText.length,
completionTokens: 0,
totalTokens: promptText.length
},
toolCalls: void 0,
functionCall: void 0,
logprobs: void 0,
systemFingerprint: void 0,
choices: [],
rawCall: {}
};
},

@@ -134,13 +163,9 @@ doStream: async (prompt) => {

stream,
response: Promise.resolve({
id: "orama-response",
created: Date.now(),
model: "orama",
usage: {
promptTokens: promptText.length,
completionTokens: 0,
totalTokens: promptText.length
}
}),
data: Promise.resolve({ id: "orama-data" })
rawCall: {
rawPrompt: promptText,
rawSettings: {}
},
rawResponse: {
headers: {}
}
};

@@ -147,0 +172,0 @@ } catch (error) {

{
"name": "@oramacloud/ai-sdk-provider",
"version": "0.1.1",
"version": "0.1.2",
"description": "Orama provider for Vercel AI SDK",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

import { OramaClient } from "@oramacloud/client";
import type { OramaProviderConfig, SearchResponse, SearchHit, SearchResult } from './types';
import { LanguageModelV1 } from '@ai-sdk/provider'
export class OramaService {

@@ -16,6 +16,20 @@ readonly client: OramaClient;

ask() {
ask(): LanguageModelV1 {
const self = this;
return {
doGenerate: async (prompt: any) => {
specificationVersion: "v1" as const,
provider: "orama" as const,
modelId: "orama-default" as const,
defaultObjectGenerationMode: "json" as const,
doGenerate: async (prompt: any): Promise<{
text: string;
finishReason: 'stop';
usage: { promptTokens: number; completionTokens: number; totalTokens: number };
toolCalls?: any[];
functionCall?: any;
logprobs?: any;
systemFingerprint?: string;
choices: any[];
rawCall: any;
}> => {
const promptText = prompt.prompt?.[0]?.content?.[0]?.text || prompt;

@@ -34,4 +48,3 @@

text: 'No results found.',
results: [],
finishReason: 'stop',
finishReason: 'stop' as const,
usage: {

@@ -41,4 +54,10 @@ promptTokens: promptText.length,

totalTokens: promptText.length + 'No results found.'.length
}
} as SearchResult;
},
toolCalls: undefined,
functionCall: undefined,
logprobs: undefined,
systemFingerprint: undefined,
choices: [],
rawCall: {}
};
}

@@ -61,4 +80,3 @@

text: formattedText,
results: searchResults,
finishReason: 'stop',
finishReason: 'stop' as const,
usage: {

@@ -68,4 +86,10 @@ promptTokens: promptText.length,

totalTokens: promptText.length + formattedText.length
}
} as SearchResult;
},
toolCalls: undefined,
functionCall: undefined,
logprobs: undefined,
systemFingerprint: undefined,
choices: [],
rawCall: {}
};
} catch (error) {

@@ -76,2 +100,18 @@ console.error('Search error:', error);

}
return {
text: '',
finishReason: 'stop' as const,
usage: {
promptTokens: promptText.length,
completionTokens: 0,
totalTokens: promptText.length
},
toolCalls: undefined,
functionCall: undefined,
logprobs: undefined,
systemFingerprint: undefined,
choices: [],
rawCall: {}
};
},

@@ -125,13 +165,9 @@ doStream: async (prompt: any) => {

stream,
response: Promise.resolve({
id: 'orama-response',
created: Date.now(),
model: 'orama',
usage: {
promptTokens: promptText.length,
completionTokens: 0,
totalTokens: promptText.length
}
}),
data: Promise.resolve({ id: 'orama-data' })
rawCall: {
rawPrompt: promptText,
rawSettings: {} as Record<string, unknown>
},
rawResponse: {
headers: {}
}
};

@@ -138,0 +174,0 @@ } catch (error) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc