UNPKG

@wildcard-ai/deepcontext

Version:

Advanced codebase indexing and semantic search MCP server

73 lines 2.13 kB
/** * Jina AI API Service - Handles all Jina AI integrations * Provides embedding generation and result reranking capabilities */ import { ConfigurationService } from './ConfigurationService.js'; export interface RerankerResult { index: number; relevance_score: number; document?: { text: string; }; } export interface RerankerResponse { results: RerankerResult[]; usage: { total_tokens: number; prompt_tokens: number; }; } export interface EmbeddingResponse { data: Array<{ embedding: number[]; index: number; }>; usage: { total_tokens: number; prompt_tokens: number; }; } export declare class JinaApiService { private apiKey; private configurationService; private readonly baseUrl; private readonly logger; constructor(apiKey: string, configurationService: ConfigurationService, loggerName?: string); /** * Generate embedding for a single text using Jina AI */ generateEmbedding(text: string): Promise<number[]>; /** * Generate embeddings for multiple texts in batch using Jina AI */ generateEmbeddingBatch(texts: string[]): Promise<number[][]>; /** * Rerank search results using Jina reranker - returns raw indices and scores */ rerank(query: string, documents: string[], topN?: number): Promise<Array<{ index: number; relevance_score: number; }>>; /** * Enhanced reranking for search results - preserves original scores and adds reranked flag */ rerankerResults(query: string, results: any[]): Promise<any[]>; /** * Truncate text content to fit within Jina API token limits * Jina API limit: 8194 tokens (roughly ~32KB of text) */ private truncateForJinaApi; /** * Check if the service is available (API key provided) */ isAvailable(): boolean; /** * Get the current embedding model name */ getEmbeddingModel(): string; /** * Get the current reranker model name */ getRerankerModel(): string; } //# sourceMappingURL=JinaApiService.d.ts.map