Skip to content

feat(custom_providers_support): support custom OpenAI/Anthropic-compatible LLM endpoints - #73

Open
erbanku wants to merge 2 commits into
vercel-labs:mainfrom
erbanku:main
Open

feat(custom_providers_support): support custom OpenAI/Anthropic-compatible LLM endpoints#73
erbanku wants to merge 2 commits into
vercel-labs:mainfrom
erbanku:main

Conversation

@erbanku

@erbanku erbanku commented Jul 4, 2026

Copy link
Copy Markdown

Add configurable provider, base URL, and model resolution for semantic search.
Enable OpenAI-compatible, Anthropic-compatible, local, and enterprise-hosted endpoints via environment variables.

Closes #72

…tible LLM endpoints

Add configurable provider, base URL, and model resolution for semantic search.
Enable OpenAI-compatible, Anthropic-compatible, local, and enterprise-hosted endpoints via environment variables.
@erbanku

erbanku commented Jul 4, 2026

Copy link
Copy Markdown
Author

I added myself to the author field in package.json because I wanted to use it with npm and needed to publish it there.
You can, of course, revert it when you publish; I completely respect that.

I have published it here: https://www.npmjs.com/package/@erbanku/lat.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends lat search/lat expand semantic search configuration to support custom OpenAI-compatible and Anthropic-compatible embedding endpoints (base URL, provider header format, model override), and adds runtime dimension resolution so the vectors DB schema can adapt to non-default embedding models.

Changes:

  • Add env/config resolvers for LAT_LLM_BASE_URL, LAT_LLM_PROVIDER, LAT_LLM_MODEL, and LAT_LLM_ANTHROPIC_VERSION, and wire them into provider detection.
  • Introduce resolveSchema() to probe/cached embedding dimensions and trigger automatic DB rebuild when provider/model changes.
  • Expand tests and documentation to cover custom endpoints and dimension resolution behavior.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/search.test.ts Adds unit tests for custom endpoint provider detection and model override dimension behavior.
tests/schema.test.ts Adds tests for schema dimension probing + caching using a local embeddings stub server.
tests/config.test.ts Adds tests for env/config resolution of custom endpoint settings and bundling into provider options.
templates/cursor-rules.md Updates guidance for semantic search setup to mention custom endpoints.
templates/AGENTS.md Updates agent guidance for semantic search setup to mention custom endpoints.
src/search/schema.ts New schema resolution layer that probes/caches embedding dimensions and detects provider/model changes.
src/search/provider.ts Adds ProviderOptions, custom base URL support, Anthropic-compatible header mode, and model overrides that clear static dims.
src/config.ts Adds config fields + env/config resolution functions for custom endpoint/provider/model settings.
src/cli/search.ts Uses provider options + schema resolution; drops/rebuilds DB table when provider signature changes; improves CLI error handling paths.
src/cli/init.ts Adds CLI init messaging describing advanced custom-endpoint environment variables.
src/cli/index.ts Enhances lat config output to show resolved LLM settings.
README.md Documents custom endpoint configuration and new env vars/config fields.
package.json Updates package metadata (name/author/repo/homepage/publishConfig) alongside the feature changes.
lat.md/tests/search.md Documents new/expanded tests for configuration, provider detection, and dimension resolution.
lat.md/cli.md Documents new config fields, provider detection order, and the dimension resolution mechanism.
CLAUDE.md Updates agent instructions for semantic search setup to mention custom endpoints.
AGENTS.md Updates agent instructions for semantic search setup to mention custom endpoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/search/schema.ts
Comment on lines +69 to +73
let dimensions = provider.dimensions;
if (dimensions === undefined && !configChanged) {
const cached = await getMeta(db, DIMENSIONS_META_KEY);
if (cached) dimensions = parseInt(cached, 10);
}
Comment thread src/cli/search.ts
Comment on lines +162 to +166
try {
await runIndex(ctx.latDir, key, progress);
} catch (err) {
return { output: (err as Error).message, isError: true };
}
Comment thread src/cli/search.ts
Comment on lines +170 to +175
let result: SearchResult;
try {
result = await runSearch(ctx.latDir, query, key, opts.limit, progress);
} catch (err) {
return { output: (err as Error).message, isError: true };
}
Comment thread package.json
Comment on lines +2 to 16
"name": "@erbanku/lat.md",
"version": "0.11.2",
"description": "A knowledge graph for your codebase, written in markdown",
"type": "module",
"packageManager": "pnpm@10.30.2",
"license": "MIT",
"author": "Yury Selivanov",
"author": "Erban Ku",
"repository": {
"type": "git",
"url": "https://github.com/1st1/lat.md.git"
"url": "git+https://github.com/erbanku/lat.md.git"
},
"homepage": "https://github.com/erbanku/lat.md",
"publishConfig": {
"access": "public"
},
Comment thread tests/schema.test.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@1st1

1st1 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@erbanku I've just implemented local embeddings support as native a default option for lat.

Anthropic-compatible LLM endpoints

Anthropic doesn't seem to have embeddings models/api, what does anthropic-compatible mean in this context?

@erbanku

erbanku commented Aug 27, 2026

Copy link
Copy Markdown
Author

Anthropic-compatible here means the API format (headers and request shape), not Anthropic’s own models. Some third-party providers expose embeddings behind that Anthropic-style API, which is what I wanted to support.

Anthropic itself doesn’t have an embeddings API, as you said. Happy to clarify that in the docs if the naming is confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support custom OpenAI/Anthropic compatible LLM endpoints

3 participants