Skip to main content
Glama

venice_create_embeddings

Generate text embeddings to enable semantic search and RAG applications by converting text into numerical representations for AI analysis.

Instructions

Generate text embeddings for semantic search and RAG

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesText or array of texts to embed
modelNoEmbedding modeltext-embedding-ada-002

Implementation Reference

  • The async handler function that makes a POST request to Venice AI's /embeddings endpoint using veniceAPI, parses the response, and returns a summary of the generated embeddings.
    async ({ input, model }) => { const response = await veniceAPI("/embeddings", { method: "POST", body: JSON.stringify({ input, model }) }); const data = await response.json() as EmbeddingsResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; const embeddings = data.data || []; return { content: [{ type: "text" as const, text: `Generated ${embeddings.length} embedding(s), dimensions: ${embeddings[0]?.embedding?.length || 0}` }] }; } );
  • Zod input schema defining the parameters for the venice_create_embeddings tool: input (string or array of strings) and optional model.
    { input: z.union([z.string(), z.array(z.string())]).describe("Text or array of texts to embed"), model: z.string().optional().default("text-embedding-ada-002").describe("Embedding model"), },
  • MCP server.tool registration call for the venice_create_embeddings tool, including name, description, input schema, and handler.
    server.tool( "venice_create_embeddings", "Generate text embeddings for semantic search and RAG", { input: z.union([z.string(), z.array(z.string())]).describe("Text or array of texts to embed"), model: z.string().optional().default("text-embedding-ada-002").describe("Embedding model"), }, async ({ input, model }) => { const response = await veniceAPI("/embeddings", { method: "POST", body: JSON.stringify({ input, model }) }); const data = await response.json() as EmbeddingsResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; const embeddings = data.data || []; return { content: [{ type: "text" as const, text: `Generated ${embeddings.length} embedding(s), dimensions: ${embeddings[0]?.embedding?.length || 0}` }] }; } );
  • veniceAPI utility function that performs authenticated fetch requests to the Venice AI API, used by the tool handler.
    export async function veniceAPI(endpoint: string, options: RequestInit = {}): Promise<Response> { const url = `${BASE_URL}${endpoint}`; const headers: Record<string, string> = { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json", ...(options.headers as Record<string, string> || {}), }; return fetch(url, { ...options, headers }); }
  • TypeScript interface defining the structure of the embeddings API response, used in the handler.
    export interface EmbeddingsResponse extends VeniceAPIError { data?: Array<{ embedding?: number[]; }>; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/georgeglarson/venice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server