Skip to main content
Glama

venice_create_embeddings

Generate text embeddings to enable semantic search and Retrieval-Augmented Generation (RAG) applications.

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 handler function that calls the Venice API to create embeddings and returns the result summary.
    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 schema defining the input parameters for the venice_create_embeddings tool.
      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"),
    },
  • Registration of the venice_create_embeddings tool in the registerInferenceTools function.
      "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}` }] };
      }
    );

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