quantum-ai-sdk 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RealtimeSender, RealtimeReceiver } from "./realtime.js";
2
2
  import type { RealtimeConfig, RealtimeSession } from "./realtime.js";
3
- import type { AccountPricingResponse, AgentEvent, AgentRequest, AlignRequest, AlignResponse, AsyncJobResponse, AuthAppleRequest, AuthResponse, AvatarsResponse, BalanceResponse, BatchJobInfo, BatchJobsResponse, BatchJsonlResponse, BatchSubmitRequest, BatchSubmitResponse, ChatRequest, ChatResponse, ChunkDocumentRequest, ChunkDocumentResponse, ClientOptions, CloneVoiceRequest, CloneVoiceResponse, CreateKeyRequest, CreateKeyResponse, CreditBalanceResponse, CreditPacksResponse, CreditPurchaseRequest, CreditPurchaseResponse, CreditTiersResponse, DeleteResponse, DevProgramApplyRequest, DevProgramApplyResponse, DialogueRequest, DialogueResponse, DigitalTwinRequest, DocumentRequest, DocumentResponse, DubRequest, DubResponse, EmbedRequest, EmbedResponse, HeyGenTemplatesResponse, HeyGenVoicesResponse, ImageEditRequest, ImageEditResponse, ImageRequest, ImageResponse, InstanceResponse, InstancesResponse, IsolateVoiceRequest, IsolateVoiceResponse, JobCreateRequest, JobCreateResponse, JobListResponse, JobStatusResponse, ListKeysResponse, MissionEvent, MissionRequest, ModelInfo, MusicRequest, MusicResponse, PhotoAvatarRequest, PricingInfo, ProcessDocumentRequest, ProcessDocumentResponse, ProvisionRequest, ProvisionResponse, RAGCorpus, RAGSearchRequest, RAGSearchResponse, RemixVoiceRequest, RemixVoiceResponse, ResponseMeta, SessionChatRequest, SessionChatResponse, SoundEffectRequest, SoundEffectResponse, SpeechToSpeechRequest, SpeechToSpeechResponse, SSHKeyRequest, StarfishTTSRequest, StarfishTTSResponse, StatusResponse, STTRequest, STTResponse, StreamEvent, SurrealRAGProvidersResponse, SurrealRAGSearchRequest, SurrealRAGSearchResponse, TemplatesResponse, TTSRequest, TTSResponse, UsageQuery, UsageResponse, UsageSummaryResponse, VideoRequest, VideoResponse, VideoStudioRequest, VideoTranslateRequest, VoiceDesignRequest, VoiceDesignResponse, VoicesResponse } from "./types.js";
3
+ import type { AccountPricingResponse, AgentEvent, AgentRequest, AlignRequest, AlignResponse, AsyncJobResponse, AuthAppleRequest, AuthResponse, AvatarsResponse, BalanceResponse, BatchJobInfo, BatchJobsResponse, BatchJsonlResponse, BatchSubmitRequest, BatchSubmitResponse, ChatRequest, ChatResponse, ChunkDocumentRequest, ChunkDocumentResponse, ClientOptions, CloneVoiceRequest, CloneVoiceResponse, CreateKeyRequest, CreateKeyResponse, CreditBalanceResponse, CreditPacksResponse, CreditPurchaseRequest, CreditPurchaseResponse, CreditTiersResponse, DeleteResponse, DevProgramApplyRequest, DevProgramApplyResponse, DialogueRequest, DialogueResponse, DigitalTwinRequest, DocumentRequest, DocumentResponse, DubRequest, DubResponse, EmbedRequest, EmbedResponse, HeyGenTemplatesResponse, HeyGenVoicesResponse, ImageEditRequest, ImageEditResponse, ImageRequest, ImageResponse, InstanceResponse, InstancesResponse, IsolateVoiceRequest, IsolateVoiceResponse, JobCreateRequest, JobCreateResponse, JobListResponse, JobStreamEvent, WebSearchRequest, WebSearchResponse, LLMContextRequest, LLMContextResponse, SearchAnswerRequest, SearchAnswerResponse, JobStatusResponse, ListKeysResponse, MissionEvent, MissionRequest, ModelInfo, MusicRequest, MusicResponse, PhotoAvatarRequest, PricingInfo, ProcessDocumentRequest, ProcessDocumentResponse, ProvisionRequest, ProvisionResponse, RAGCorpus, RAGSearchRequest, RAGSearchResponse, RemixVoiceRequest, RemixVoiceResponse, ResponseMeta, SessionChatRequest, SessionChatResponse, SoundEffectRequest, SoundEffectResponse, SpeechToSpeechRequest, SpeechToSpeechResponse, SSHKeyRequest, StarfishTTSRequest, StarfishTTSResponse, StatusResponse, STTRequest, STTResponse, StreamEvent, SurrealRAGProvidersResponse, SurrealRAGSearchRequest, SurrealRAGSearchResponse, TemplatesResponse, TTSRequest, TTSResponse, UsageQuery, UsageResponse, UsageSummaryResponse, VideoRequest, VideoResponse, VideoStudioRequest, VideoTranslateRequest, VoiceDesignRequest, VoiceDesignResponse, VoicesResponse } from "./types.js";
4
4
  /**
5
5
  * QuantumClient is the Quantum AI API client.
6
6
  *
@@ -151,6 +151,12 @@ export declare class QuantumClient {
151
151
  surrealRagSearch(req: SurrealRAGSearchRequest): Promise<SurrealRAGSearchResponse>;
152
152
  /** List available documentation providers in SurrealDB RAG. */
153
153
  surrealRagProviders(): Promise<SurrealRAGProvidersResponse>;
154
+ /** Perform a web search. Returns web results, news, videos, infobox, discussions. */
155
+ webSearch(req: WebSearchRequest): Promise<WebSearchResponse>;
156
+ /** Get LLM-optimized content chunks for grounding. */
157
+ searchContext(req: LLMContextRequest): Promise<LLMContextResponse>;
158
+ /** Get a grounded AI answer with citations. */
159
+ searchAnswer(req: SearchAnswerRequest): Promise<SearchAnswerResponse>;
154
160
  /** List all available models with provider and pricing information. */
155
161
  listModels(): Promise<ModelInfo[]>;
156
162
  /** Get the complete pricing table for all models. */
@@ -177,6 +183,19 @@ export declare class QuantumClient {
177
183
  pollJob(jobId: string, intervalMs?: number, maxAttempts?: number): Promise<JobStatusResponse>;
178
184
  /** List all jobs for the authenticated user. */
179
185
  listJobs(): Promise<JobListResponse>;
186
+ /**
187
+ * Submit a chat completion as an async job.
188
+ * Use for long-running models (e.g. Opus) where sync chat may time out.
189
+ * Params are the same shape as ChatRequest (model, messages, tools, etc.)
190
+ */
191
+ chatJob(req: Omit<ChatRequest, "stream">): Promise<JobCreateResponse>;
192
+ /**
193
+ * Stream job progress via SSE. Yields events as the job runs.
194
+ * Events: progress (status update), complete (with result), error.
195
+ */
196
+ streamJob(jobId: string, signal?: AbortSignal): AsyncIterableIterator<JobStreamEvent>;
197
+ /** Generate a 3D model via the async jobs system. */
198
+ generate3D(model: string, prompt?: string, imageUrl?: string): Promise<JobCreateResponse>;
180
199
  /** Create a scoped API key. */
181
200
  createKey(req: CreateKeyRequest): Promise<CreateKeyResponse>;
182
201
  /** List all API keys for the authenticated user. */
package/dist/client.js CHANGED
@@ -10,7 +10,8 @@ import { extractDocument, chunkDocument, processDocument } from "./documents.js"
10
10
  import { ragSearch, ragCorpora, surrealRagSearch, surrealRagProviders } from "./rag.js";
11
11
  import { listModels, getPricing } from "./models.js";
12
12
  import { accountBalance, accountUsage, accountUsageSummary, accountPricing, } from "./account.js";
13
- import { createJob, getJob, pollJob, listJobs } from "./jobs.js";
13
+ import { createJob, getJob, pollJob, listJobs, chatJob, streamJob, generate3D } from "./jobs.js";
14
+ import { webSearch, searchContext, searchAnswer } from "./search.js";
14
15
  import { createKey, listKeys, revokeKey } from "./keys.js";
15
16
  import { computeTemplates, computeProvision, computeInstances, computeInstance, computeDelete, computeSSHKey, computeKeepalive, } from "./compute.js";
16
17
  import { listVoices, cloneVoice, deleteVoice } from "./voices.js";
@@ -256,6 +257,19 @@ export class QuantumClient {
256
257
  async surrealRagProviders() {
257
258
  return surrealRagProviders(this);
258
259
  }
260
+ // ── Search (Brave) ──────────────────────────────────────────────
261
+ /** Perform a web search. Returns web results, news, videos, infobox, discussions. */
262
+ async webSearch(req) {
263
+ return webSearch(this, req);
264
+ }
265
+ /** Get LLM-optimized content chunks for grounding. */
266
+ async searchContext(req) {
267
+ return searchContext(this, req);
268
+ }
269
+ /** Get a grounded AI answer with citations. */
270
+ async searchAnswer(req) {
271
+ return searchAnswer(this, req);
272
+ }
259
273
  // ── Models ────────────────────────────────────────────────────────
260
274
  /** List all available models with provider and pricing information. */
261
275
  async listModels() {
@@ -305,6 +319,25 @@ export class QuantumClient {
305
319
  async listJobs() {
306
320
  return listJobs(this);
307
321
  }
322
+ /**
323
+ * Submit a chat completion as an async job.
324
+ * Use for long-running models (e.g. Opus) where sync chat may time out.
325
+ * Params are the same shape as ChatRequest (model, messages, tools, etc.)
326
+ */
327
+ async chatJob(req) {
328
+ return chatJob(this, req);
329
+ }
330
+ /**
331
+ * Stream job progress via SSE. Yields events as the job runs.
332
+ * Events: progress (status update), complete (with result), error.
333
+ */
334
+ streamJob(jobId, signal) {
335
+ return streamJob(this, jobId, signal);
336
+ }
337
+ /** Generate a 3D model via the async jobs system. */
338
+ async generate3D(model, prompt, imageUrl) {
339
+ return generate3D(this, model, prompt, imageUrl);
340
+ }
308
341
  // ── API Keys ──────────────────────────────────────────────────────
309
342
  /** Create a scoped API key. */
310
343
  async createKey(req) {
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { responseText, responseThinking, responseToolCalls } from "./chat.js";
4
4
  export { realtimeConnect, realtimeConnectDirect, realtimeSession, realtimeEnd, realtimeRefresh, RealtimeSender, RealtimeReceiver } from "./realtime.js";
5
5
  export type { RealtimeConfig, RealtimeEvent, RealtimeSession } from "./realtime.js";
6
6
  export { contact } from "./contact.js";
7
- export type { ClientOptions, ResponseMeta, ChatRequest, ChatMessage, ChatTool, ContentBlock, ChatUsage, ChatResponse, StreamEvent, StreamDelta, StreamToolUse, SessionChatRequest, SessionChatResponse, SessionToolResult, ContextConfig, ContextMetadata, AgentRequest, AgentWorkerConfig, AgentEvent, MissionRequest, MissionWorkerConfig, MissionEvent, ImageRequest, ImageResponse, GeneratedImage, ImageEditRequest, ImageEditResponse, TTSRequest, TTSResponse, STTRequest, STTResponse, MusicRequest, MusicClip, MusicResponse, SoundEffectRequest, SoundEffectResponse, DialogueRequest, DialogueResponse, DialogueVoice, SpeechToSpeechRequest, SpeechToSpeechResponse, IsolateVoiceRequest, IsolateVoiceResponse, RemixVoiceRequest, RemixVoiceResponse, DubRequest, DubResponse, AlignRequest, AlignResponse, AlignedWord, VoiceDesignRequest, VoiceDesignResponse, VoicePreview, StarfishTTSRequest, StarfishTTSResponse, VideoRequest, VideoResponse, GeneratedVideo, VideoStudioRequest, VideoTranslateRequest, PhotoAvatarRequest, DigitalTwinRequest, AsyncJobResponse, AvatarsResponse, HeyGenAvatar, HeyGenTemplatesResponse, HeyGenTemplate, HeyGenVoicesResponse, HeyGenVoice, EmbedRequest, EmbedResponse, DocumentRequest, DocumentResponse, ChunkDocumentRequest, ChunkDocumentResponse, DocumentChunk, ProcessDocumentRequest, ProcessDocumentResponse, RAGSearchRequest, RAGSearchResponse, RAGResult, RAGCorpus, SurrealRAGSearchRequest, SurrealRAGSearchResponse, SurrealRAGResult, SurrealRAGProvidersResponse, SurrealRAGProviderInfo, ModelInfo, PricingInfo, BalanceResponse, UsageEntry, UsageResponse, UsageQuery, UsageSummaryMonth, UsageSummaryResponse, PricingEntry, AccountPricingResponse, JobCreateRequest, JobCreateResponse, JobStatusResponse, JobListResponse, JobListItem, CreateKeyRequest, CreateKeyResponse, KeyDetails, ListKeysResponse, ComputeTemplate, TemplatesResponse, ProvisionRequest, ProvisionResponse, ComputeInstanceInfo, InstancesResponse, InstanceDetailInfo, InstanceResponse, SSHKeyRequest, DeleteResponse, VoiceInfo, VoicesResponse, CloneVoiceRequest, CloneVoiceResponse, ContactRequest, BatchJobInput, BatchSubmitRequest, BatchSubmitResponse, BatchJsonlResponse, BatchJobInfo, BatchJobsResponse, CreditPack, CreditPacksResponse, CreditPurchaseRequest, CreditPurchaseResponse, CreditBalanceResponse, CreditTier, CreditTiersResponse, DevProgramApplyRequest, DevProgramApplyResponse, AuthUser, AuthResponse, AuthAppleRequest, StatusResponse, } from "./types.js";
7
+ export type { ClientOptions, ResponseMeta, ChatRequest, ChatMessage, ChatTool, ContentBlock, ChatUsage, ChatResponse, StreamEvent, StreamDelta, StreamToolUse, SessionChatRequest, SessionChatResponse, SessionToolResult, ContextConfig, ContextMetadata, AgentRequest, AgentWorkerConfig, AgentEvent, MissionRequest, MissionWorkerConfig, MissionEvent, ImageRequest, ImageResponse, GeneratedImage, ImageEditRequest, ImageEditResponse, TTSRequest, TTSResponse, STTRequest, STTResponse, MusicRequest, MusicClip, MusicResponse, SoundEffectRequest, SoundEffectResponse, DialogueRequest, DialogueResponse, DialogueVoice, SpeechToSpeechRequest, SpeechToSpeechResponse, IsolateVoiceRequest, IsolateVoiceResponse, RemixVoiceRequest, RemixVoiceResponse, DubRequest, DubResponse, AlignRequest, AlignResponse, AlignedWord, VoiceDesignRequest, VoiceDesignResponse, VoicePreview, StarfishTTSRequest, StarfishTTSResponse, VideoRequest, VideoResponse, GeneratedVideo, VideoStudioRequest, VideoTranslateRequest, PhotoAvatarRequest, DigitalTwinRequest, AsyncJobResponse, AvatarsResponse, HeyGenAvatar, HeyGenTemplatesResponse, HeyGenTemplate, HeyGenVoicesResponse, HeyGenVoice, EmbedRequest, EmbedResponse, DocumentRequest, DocumentResponse, ChunkDocumentRequest, ChunkDocumentResponse, DocumentChunk, ProcessDocumentRequest, ProcessDocumentResponse, RAGSearchRequest, RAGSearchResponse, RAGResult, RAGCorpus, SurrealRAGSearchRequest, SurrealRAGSearchResponse, SurrealRAGResult, SurrealRAGProvidersResponse, SurrealRAGProviderInfo, ModelInfo, PricingInfo, BalanceResponse, UsageEntry, UsageResponse, UsageQuery, UsageSummaryMonth, UsageSummaryResponse, PricingEntry, AccountPricingResponse, JobCreateRequest, JobCreateResponse, JobStatusResponse, JobListResponse, JobStreamEvent, JobListItem, CreateKeyRequest, CreateKeyResponse, KeyDetails, ListKeysResponse, ComputeTemplate, TemplatesResponse, ProvisionRequest, ProvisionResponse, ComputeInstanceInfo, InstancesResponse, InstanceDetailInfo, InstanceResponse, SSHKeyRequest, DeleteResponse, VoiceInfo, VoicesResponse, CloneVoiceRequest, CloneVoiceResponse, ContactRequest, BatchJobInput, BatchSubmitRequest, BatchSubmitResponse, BatchJsonlResponse, BatchJobInfo, BatchJobsResponse, CreditPack, CreditPacksResponse, CreditPurchaseRequest, CreditPurchaseResponse, CreditBalanceResponse, CreditTier, CreditTiersResponse, DevProgramApplyRequest, DevProgramApplyResponse, AuthUser, AuthResponse, AuthAppleRequest, WebSearchRequest, WebSearchResponse, WebSearchResult, NewsResult, VideoSearchResult, LLMContextRequest, LLMContextResponse, ContentChunk, ContextSource, SearchAnswerRequest, SearchAnswerResponse, SearchAnswerChoice, SearchCitation, StatusResponse, } from "./types.js";
8
8
  export { DEFAULT_BASE_URL, TICKS_PER_USD } from "./types.js";
9
9
  import type { ChatMessage } from "./types.js";
10
10
  /** Create a user message. */
package/dist/jobs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { QuantumClient } from "./client.js";
2
- import type { JobCreateRequest, JobCreateResponse, JobListResponse, JobStatusResponse } from "./types.js";
2
+ import type { ChatRequest, JobCreateRequest, JobCreateResponse, JobListResponse, JobStatusResponse, JobStreamEvent } from "./types.js";
3
3
  /**
4
4
  * Create an async job. Returns the job ID for polling.
5
5
  * @internal
@@ -26,3 +26,21 @@ export declare function listJobs(client: QuantumClient): Promise<JobListResponse
26
26
  * @internal
27
27
  */
28
28
  export declare function generate3D(client: QuantumClient, model: string, prompt?: string, imageUrl?: string): Promise<JobCreateResponse>;
29
+ /**
30
+ * Submit a chat completion as an async job. Useful for long-running
31
+ * models (e.g. Opus) where synchronous /qai/v1/chat may time out.
32
+ *
33
+ * Params are the same shape as ChatRequest (model, messages, tools, etc.)
34
+ * Use streamJob() or pollJob() to get the result.
35
+ * @internal
36
+ */
37
+ export declare function chatJob(client: QuantumClient, req: Omit<ChatRequest, "stream">): Promise<JobCreateResponse>;
38
+ /**
39
+ * Stream job progress via SSE. Yields events as the job runs.
40
+ *
41
+ * Events: { type: "progress", status } | { type: "complete", result, cost_ticks } | { type: "error", error }
42
+ *
43
+ * If the job is already terminal, yields one event and returns.
44
+ * @internal
45
+ */
46
+ export declare function streamJob(client: QuantumClient, jobId: string, signal?: AbortSignal): AsyncIterableIterator<JobStreamEvent>;
package/dist/jobs.js CHANGED
@@ -54,3 +54,75 @@ export async function generate3D(client, model, prompt, imageUrl) {
54
54
  params.image_url = imageUrl;
55
55
  return createJob(client, { type: "3d/generate", params });
56
56
  }
57
+ /**
58
+ * Submit a chat completion as an async job. Useful for long-running
59
+ * models (e.g. Opus) where synchronous /qai/v1/chat may time out.
60
+ *
61
+ * Params are the same shape as ChatRequest (model, messages, tools, etc.)
62
+ * Use streamJob() or pollJob() to get the result.
63
+ * @internal
64
+ */
65
+ export async function chatJob(client, req) {
66
+ return createJob(client, {
67
+ type: "chat",
68
+ params: req,
69
+ });
70
+ }
71
+ /**
72
+ * Stream job progress via SSE. Yields events as the job runs.
73
+ *
74
+ * Events: { type: "progress", status } | { type: "complete", result, cost_ticks } | { type: "error", error }
75
+ *
76
+ * If the job is already terminal, yields one event and returns.
77
+ * @internal
78
+ */
79
+ export async function* streamJob(client, jobId, signal) {
80
+ // Job stream is GET, not POST — use _doJSON's fetch directly.
81
+ const headers = {
82
+ Authorization: `Bearer ${client._apiKey}`,
83
+ Accept: "text/event-stream",
84
+ };
85
+ const response = await client._fetch(`${client._baseUrl}/qai/v1/jobs/${jobId}/stream`, { method: "GET", headers, signal });
86
+ if (!response.ok) {
87
+ throw new Error(`Job stream error (${response.status})`);
88
+ }
89
+ const reader = response.body;
90
+ if (!reader) {
91
+ throw new Error("qai: response body is null");
92
+ }
93
+ const decoder = new TextDecoder();
94
+ const streamReader = reader.getReader();
95
+ let buffer = "";
96
+ try {
97
+ while (true) {
98
+ const { done, value } = await streamReader.read();
99
+ if (done)
100
+ break;
101
+ buffer += decoder.decode(value, { stream: true });
102
+ const lines = buffer.split("\n");
103
+ buffer = lines.pop() ?? "";
104
+ for (const line of lines) {
105
+ if (!line.startsWith("data: "))
106
+ continue;
107
+ const payload = line.slice(6);
108
+ if (payload === "[DONE]")
109
+ return;
110
+ let event;
111
+ try {
112
+ event = JSON.parse(payload);
113
+ }
114
+ catch {
115
+ yield { type: "error", error: "parse SSE: invalid JSON" };
116
+ return;
117
+ }
118
+ yield event;
119
+ if (event.type === "complete" || event.type === "error") {
120
+ return;
121
+ }
122
+ }
123
+ }
124
+ }
125
+ finally {
126
+ streamReader.releaseLock();
127
+ }
128
+ }
@@ -0,0 +1,17 @@
1
+ import type { QuantumClient } from "./client.js";
2
+ import type { WebSearchRequest, WebSearchResponse, LLMContextRequest, LLMContextResponse, SearchAnswerRequest, SearchAnswerResponse } from "./types.js";
3
+ /**
4
+ * Perform a Brave web search.
5
+ * @internal
6
+ */
7
+ export declare function webSearch(client: QuantumClient, req: WebSearchRequest): Promise<WebSearchResponse>;
8
+ /**
9
+ * Get LLM-optimized content chunks for a query.
10
+ * @internal
11
+ */
12
+ export declare function searchContext(client: QuantumClient, req: LLMContextRequest): Promise<LLMContextResponse>;
13
+ /**
14
+ * Get a grounded AI answer with citations.
15
+ * @internal
16
+ */
17
+ export declare function searchAnswer(client: QuantumClient, req: SearchAnswerRequest): Promise<SearchAnswerResponse>;
package/dist/search.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Perform a Brave web search.
3
+ * @internal
4
+ */
5
+ export async function webSearch(client, req) {
6
+ const { data } = await client._doJSON("POST", "/qai/v1/search/web", req);
7
+ return data;
8
+ }
9
+ /**
10
+ * Get LLM-optimized content chunks for a query.
11
+ * @internal
12
+ */
13
+ export async function searchContext(client, req) {
14
+ const { data } = await client._doJSON("POST", "/qai/v1/search/context", req);
15
+ return data;
16
+ }
17
+ /**
18
+ * Get a grounded AI answer with citations.
19
+ * @internal
20
+ */
21
+ export async function searchAnswer(client, req) {
22
+ const { data } = await client._doJSON("POST", "/qai/v1/search/answer", req);
23
+ return data;
24
+ }
package/dist/types.d.ts CHANGED
@@ -725,6 +725,144 @@ export interface JobListItem {
725
725
  export interface JobListResponse {
726
726
  jobs: JobListItem[];
727
727
  }
728
+ /** SSE event from GET /qai/v1/jobs/{id}/stream */
729
+ export interface JobStreamEvent {
730
+ type: "progress" | "complete" | "error";
731
+ job_id?: string;
732
+ status?: string;
733
+ result?: unknown;
734
+ error?: string;
735
+ cost_ticks?: number;
736
+ completed_at?: string;
737
+ }
738
+ export interface WebSearchRequest {
739
+ query: string;
740
+ count?: number;
741
+ offset?: number;
742
+ country?: string;
743
+ language?: string;
744
+ freshness?: "pd" | "pw" | "pm";
745
+ safesearch?: string;
746
+ }
747
+ export interface WebSearchResult {
748
+ title?: string;
749
+ url?: string;
750
+ description?: string;
751
+ extra_snippets?: string[];
752
+ age?: string;
753
+ language?: string;
754
+ thumbnail?: {
755
+ src?: string;
756
+ height?: number;
757
+ width?: number;
758
+ };
759
+ }
760
+ export interface NewsResult {
761
+ title?: string;
762
+ url?: string;
763
+ description?: string;
764
+ age?: string;
765
+ source?: string;
766
+ thumbnail?: {
767
+ src?: string;
768
+ height?: number;
769
+ width?: number;
770
+ };
771
+ }
772
+ export interface VideoSearchResult {
773
+ title?: string;
774
+ url?: string;
775
+ description?: string;
776
+ age?: string;
777
+ thumbnail?: {
778
+ src?: string;
779
+ height?: number;
780
+ width?: number;
781
+ };
782
+ }
783
+ export interface WebSearchResponse {
784
+ query?: {
785
+ original?: string;
786
+ altered?: string;
787
+ language?: string;
788
+ };
789
+ web?: {
790
+ results: WebSearchResult[];
791
+ family_friendly?: boolean;
792
+ };
793
+ news?: {
794
+ results: NewsResult[];
795
+ };
796
+ videos?: {
797
+ results: VideoSearchResult[];
798
+ };
799
+ infobox?: {
800
+ title?: string;
801
+ url?: string;
802
+ description?: string;
803
+ long_desc?: string;
804
+ };
805
+ discussions?: {
806
+ results: {
807
+ title?: string;
808
+ url?: string;
809
+ description?: string;
810
+ age?: string;
811
+ }[];
812
+ };
813
+ }
814
+ export interface LLMContextRequest {
815
+ query: string;
816
+ count?: number;
817
+ country?: string;
818
+ language?: string;
819
+ freshness?: "pd" | "pw" | "pm";
820
+ }
821
+ export interface ContentChunk {
822
+ content?: string;
823
+ url?: string;
824
+ title?: string;
825
+ score?: number;
826
+ content_type?: string;
827
+ index?: number;
828
+ }
829
+ export interface ContextSource {
830
+ url?: string;
831
+ title?: string;
832
+ description?: string;
833
+ snippet?: string;
834
+ }
835
+ export interface LLMContextResponse {
836
+ chunks: ContentChunk[];
837
+ sources?: ContextSource[];
838
+ query?: string;
839
+ }
840
+ export interface SearchAnswerRequest {
841
+ messages: {
842
+ role: string;
843
+ content: string;
844
+ }[];
845
+ model?: string;
846
+ }
847
+ export interface SearchAnswerChoice {
848
+ index?: number;
849
+ message?: {
850
+ role: string;
851
+ content: string;
852
+ };
853
+ finish_reason?: string;
854
+ }
855
+ export interface SearchCitation {
856
+ url?: string;
857
+ title?: string;
858
+ snippet?: string;
859
+ }
860
+ export interface SearchAnswerResponse {
861
+ choices: SearchAnswerChoice[];
862
+ model?: string;
863
+ id?: string;
864
+ citations?: SearchCitation[];
865
+ }
728
866
  export interface CreateKeyRequest {
729
867
  name: string;
730
868
  scopes?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-ai-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Cosmic Duck SDK — 100+ AI endpoints across 10 providers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",