--- license: cc-by-nc-4.0 configs: - config_name: embeddings data_files: "embeddings.parquet" default: true - config_name: tools data_files: "tools.parquet" task_categories: - feature-extraction - text-classification language: - "en" - "no" tags: - embeddings - openapi - tripletex - accounting - api-tools - rag - lancedb - pydantic size_categories: - n<1K --- # Tripletex API Tool Embeddings Pre-computed embeddings for 800 Tripletex accounting API tools, extracted from the OpenAPI 3.0.1 spec and embedded with Google `gemini-embedding-001` (3072 dimensions). Built for RAG-based tool filtering in the [AI Accounting Agent](https://github.com/kuben-labs/nmai) competition project. ## Quick Start ```python from datasets import load_dataset # Full embeddings (800 tools, 3072-dim vectors) — ready for RAG ds = load_dataset("valiantlynxz/tripletex-tool-embeddings") # Lightweight: tool metadata only, no embedding vectors ds = load_dataset("valiantlynxz/tripletex-tool-embeddings", name="tools") ``` ## Configurations | Config | Default | Columns | Size | Use case | |--------|---------|---------|------|----------| | `embeddings` | Yes | name, description, parameters, embedding | ~9 MB | RAG search, vector index | | `tools` | | name, description, parameters | ~50 KB | Browsing, filtering, analysis | ## Schema ### `embeddings` config ```python ds = load_dataset("valiantlynxz/tripletex-tool-embeddings") example = ds["train"][0] example["name"] # "AccountantDashboardNews_get" example["description"] # "Get public news articles" example["parameters"] # '{"from": "integer", "count": "integer", ...}' (JSON string) example["embedding"] # [3072 floats] — gemini-embedding-001 vector ``` ### `tools` config ```python ds = load_dataset("valiantlynxz/tripletex-tool-embeddings", name="tools") example = ds["train"][0] example["name"] # "AccountantDashboardNews_get" example["description"] # "Get public news articles" example["parameters"] # '{"from": "integer", "count": "integer", ...}' (JSON string) ``` ## Data Summary - **800 API tools** from the Tripletex accounting API (OpenAPI 3.0.1) - **3072-dimensional embeddings** via Google `gemini-embedding-001` - **Parameters** stored as JSON strings mapping param names to types - **Source:** `openapi.json` included in this repo (3.5 MB, 546 paths, 2167 schemas) ## Using with LanceDB ```python from datasets import load_dataset import lancedb ds = load_dataset("valiantlynxz/tripletex-tool-embeddings") # Convert to LanceDB db = lancedb.connect(".tool_embeddings") records = [ { "name": row["name"], "description": row["description"], "parameters": row["parameters"], "embedding": row["embedding"], } for row in ds["train"] ] table = db.create_table("tools", data=records, mode="overwrite") # Search results = table.search(query_embedding).limit(100).to_list() ``` ## Using with FAISS ```python from datasets import load_dataset import numpy as np import faiss ds = load_dataset("valiantlynxz/tripletex-tool-embeddings") embeddings = np.array(ds["train"]["embedding"], dtype=np.float32) index = faiss.IndexFlatIP(3072) faiss.normalize_L2(embeddings) index.add(embeddings) # Search query = np.array([query_embedding], dtype=np.float32) faiss.normalize_L2(query) distances, indices = index.search(query, k=100) tool_names = [ds["train"][int(i)]["name"] for i in indices[0]] ``` ## Regenerating Embeddings The `scripts/` directory contains the original embedding pipeline: - `scripts/embeddings.py` — Google Gemini embedding provider - `scripts/rag_tool_filter.py` — OpenAPI-to-embedding pipeline + LanceDB vector store ```python # Requires: google-genai, lancedb # Requires: GCP_API_KEY environment variable from scripts.embeddings import get_embedding_provider from scripts.rag_tool_filter import ToolEmbedder, ToolVectorStore, index_openapi_tools import json, asyncio with open("openapi.json") as f: spec = json.load(f) provider = get_embedding_provider() embedder = ToolEmbedder(provider) store = ToolVectorStore(".tool_embeddings") asyncio.run(index_openapi_tools(spec, store, embedder)) ``` ## Repo Structure ``` tripletex-tool-embeddings/ ├── README.md ├── embeddings.parquet # 800 tools with 3072-dim embeddings ├── tools.parquet # 800 tools metadata only (lightweight) ├── openapi.json # Source Tripletex OpenAPI 3.0.1 spec (3.5 MB) └── scripts/ ├── embeddings.py # Google Gemini embedding provider └── rag_tool_filter.py # OpenAPI extraction + LanceDB indexing ``` ## Source Project Part of the [nmai](https://github.com/kuben-labs/nmai) project — `ai-accounting-agent/`.