{"schemaVersion":1,"resourceType":"connector","slug":"llm","name":"LLM","catalog":"llm","description":"Call LLMs from SQL — Anthropic, OpenAI, OpenRouter or local Ollama — plus local embeddings","language":"Python","categories":["ai"],"repository":"https://github.com/Query-farm/vgi-llm","license":"MIT","generatedAt":"2026-12-01T18:22:16+00:00","runtime":{"engineVersion":"2.0.1","protocolVersion":"3.4"},"release":{"tag":"v0.5.0","publishedAt":"2026-11-25T18:31:09Z","url":"https://github.com/Query-farm/vgi-llm/releases/tag/v0.5.0"},"links":{"html":"https://query.farm/products/orchard/connectors/llm/","llms":"https://query.farm/products/orchard/connectors/llm/llms.txt","markdown":"https://query.farm/products/orchard/connectors/llm/index.md","json":"https://query.farm/products/orchard/api/v1/connectors/llm.json","objects":"https://query.farm/products/orchard/api/v1/connectors/llm/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=llm&q={query}"},"authentication":{"mode":"optional","guidance":"Local embeddings and Ollama need no key; add provider keys for hosted models.","interpretation":"Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute(\"CREATE SECRET stripe (TYPE stripe, api_key ?)\", [os.environ[\"STRIPE_API_KEY\"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.","secrets":[{"type":"llm","description":"Provider keys for vgi-llm (one field per backend: Anthropic / OpenRouter / OpenAI / Ollama).","documentation":"https://github.com/Query-farm/vgi-llm#add-a-cloud-provider","parameters":[{"name":"anthropic_api_key","type":"VARCHAR","required":false,"redact":true,"description":"Anthropic API key (sk-ant-...) from console.anthropic.com > API Keys"},{"name":"openrouter_api_key","type":"VARCHAR","required":false,"redact":true,"description":"OpenRouter API key (sk-or-...) from openrouter.ai/keys"},{"name":"openai_api_key","type":"VARCHAR","required":false,"redact":true,"description":"OpenAI API key (sk-...) from platform.openai.com/api-keys"},{"name":"ollama_host","type":"VARCHAR","required":false,"redact":false,"description":"Base URL of a local Ollama daemon, e.g. http://localhost:11434 (no key needed)"}],"requiredBy":["ai_complete","ai_complete_details","ai_complete_image","ai_classify","ai_filter","ai_extract","ai_sentiment","ai_summarize","ai_agg","ai_summarize_agg"],"createSql":"CREATE SECRET llm (\n    TYPE llm,\n    anthropic_api_key  '<ANTHROPIC_API_KEY>',  -- secret\n    openrouter_api_key '<OPENROUTER_API_KEY>',  -- secret\n    openai_api_key     '<OPENAI_API_KEY>',  -- secret\n    ollama_host        '<ollama_host>'\n);"}]},"deployment":{"local":{"methods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'llm' AS llm (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-llm@v0.5.0 vgi-llm-worker'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'llm' AS llm (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-llm:0.5.0'\n);"}]}],"pinnedMethods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'llm' AS llm (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-llm@v0.5.0 vgi-llm-worker'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'llm' AS llm (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-llm:0.5.0'\n);"}]}]},"selfHost":{"instructions":"https://github.com/Query-farm/vgi-llm","connectionGuide":"https://query.farm/vgi/connect-to-a-worker/","guidance":"Deploy using the connector repository instructions and use its supported HTTP or SSH transport. Replace example URLs with your actual deployment; configure its authentication."},"queryFarm":{"available":true,"console":"https://auth.queryfarm.cloud/console/new?worker=llm","organizationMonthlyMinimumUsd":10,"pricing":"https://query.farm/products/orchard/hosted/"},"publicDemo":null},"setup":{"extensions":{"duckdb":"SET allow_extension_repositories = 'allowed';\n\nCREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm\n    WITH PREFIX 'https://duckdb-extensions.query.farm';\n\nINSTALL vgi FROM query_farm;\nLOAD vgi FROM query_farm;","haybarn":"INSTALL vgi FROM community;\nLOAD vgi;"},"attachSql":"ATTACH 'llm' AS llm (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-llm@v0.5.0 vgi-llm-worker'\n);","attachOptions":[],"note":"Install and load VGI, attach the connector using the catalog alias shown here, then create required secrets. Replace placeholders and omit unused optional secret parameters. Satisfy file, network and credential prerequisites before executing a query."},"example":{"title":"Find documents by meaning with local embeddings","sql":"WITH docs(doc) AS (VALUES ('DuckDB is an in-process analytical SQL database'), ('Paris is the capital of France'), ('Kittens are young cats'), ('PostgreSQL is a client-server relational database')), q AS (SELECT llm.main.ai_embed('embedded database for analytics') AS v) SELECT doc, ROUND(llm.main.ai_similarity(llm.main.ai_embed(doc), q.v), 3) AS score FROM docs, q ORDER BY score DESC LIMIT 2","requiresCredentials":null,"note":null,"objects":[{"name":"llm.main.ai_embed","kind":"scalar_function","links":{"html":"https://query.farm/products/orchard/connectors/llm/#obj-main-ai_embed","markdown":"https://query.farm/products/orchard/connectors/llm/objects/scalar_function.bWFpbg.YWlfZW1iZWQ.md","json":"https://query.farm/products/orchard/api/v1/connectors/llm/objects/scalar_function.bWFpbg.YWlfZW1iZWQ.json"}},{"name":"llm.main.ai_similarity","kind":"scalar_function","links":{"html":"https://query.farm/products/orchard/connectors/llm/#obj-main-ai_similarity","markdown":"https://query.farm/products/orchard/connectors/llm/objects/scalar_function.bWFpbg.YWlfc2ltaWxhcml0eQ.md","json":"https://query.farm/products/orchard/api/v1/connectors/llm/objects/scalar_function.bWFpbg.YWlfc2ltaWxhcml0eQ.json"}}],"evidence":{"status":"captured_result","capturedAt":"2026-12-01T06:16:30+00:00","engineVersion":"2.0.1","protocolVersion":"3.4.0","releaseTag":"v0.5.0","sample":{"columns":["doc","score"],"types":["VARCHAR","DOUBLE"],"rows":[["DuckDB is an in-process analytical SQL database",0.784],["PostgreSQL is a client-server relational database",0.712]],"more":false}},"artifact":null},"objects":{"total":20,"index":"https://query.farm/products/orchard/api/v1/connectors/llm/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=llm&q={query}"},"agentTasks":["Embed the word 'database' and confirm the vector has 384 dimensions. Return a single boolean.","Compute the cosine similarity of the embedding of 'database' with itself, rounded to 3 decimals.","Is 'dog' more similar to 'puppy' than to 'airplane'? Return a single boolean.","Use the prompt() function to render 'Hi {}' with the value 'Sam'.","Estimate the number of tokens in the text 'the quick brown fox' and confirm it is positive.","Ask the model to reply with the single word pong and confirm a non-empty answer comes back.","Get the completion details for a short prompt and confirm the text field is populated.","Describe an image BLOB with the multimodal completion function."],"provenance":{"generatedAt":"2026-12-01T18:22:16+00:00","repository":"https://github.com/Query-farm/vgi-llm","harvest":{"status":"ok","method":"subprocess","error":null,"vgi_version":"9773130dde"},"catalogVerification":{"verified":true,"status":"passed","total":6,"passed":6,"failed":0,"needs_credentials":0,"location":"uvx --from git+https://github.com/Query-farm/vgi-llm@v0.5.0 vgi-llm-worker","transport":"subprocess","environment":{"vgi_extension_version":"9773130dde","haybarn_version":"2.0.1rc3","engine_version":"v2.0.1","python":"3.12.4","platform":"darwin_arm64","protocol_version":"3.4.0"},"checked_at":"2026-12-01T06:14:11+00:00"},"interpretation":"Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."},"interpretation":["Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.","Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.","A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.","Service credentials, external data availability and deployment authentication are separate requirements."]}