Skip to content

feat(core): configure custom OpenAI embedding endpoints - #1370

Merged
phernandez merged 2 commits into
mainfrom
fix/1336-openai-embedding-endpoint
Aug 29, 2026
Merged

feat(core): configure custom OpenAI embedding endpoints#1370
phernandez merged 2 commits into
mainfrom
fix/1336-openai-embedding-endpoint

Conversation

@phernandez

Copy link
Copy Markdown
Member

Supersedes #1365 by @mikemikimike — their commit is cherry-picked here unchanged (authorship and sign-off preserved; the PR's second commit was just a merge of main and is dropped), so the full CI matrix runs. Will be rebase-merged so the commit lands on main as-is.

Fixes #1336.

What it does

The openai embedding provider now uses semantic_embedding_api_base / semantic_embedding_api_key, so it can point at any OpenAI-compatible endpoint (llama.cpp, vLLM, TEI, LM Studio, Ollama's shim) via the stable provider instead of the experimental litellm path.

  • create_embedding_provider forwards api_key/base_url to OpenAIEmbeddingProvider in the openai branch.
  • _provider_cache_key now digests those two config values for both openai and litellm, so switching endpoint or credential in-process doesn't reuse a stale provider.

This is exactly the two-step change scoped on #1336.

Review notes (verified locally)

  • OpenAIEmbeddingProvider already accepts api_key/base_url and stores them as _api_key/_base_url (what the new tests assert). Both are None-safe: an absent key falls back to OPENAI_API_KEY (then errors if still missing), an absent base_url uses the default OpenAI endpoint — so default OpenAI usage is unchanged.
  • No keyword collision: the openai branch's extra_kwargs only ever carries dimensions, never api_key/base_url.

Verification

  • ruff check / ruff format --check / ty check src tests test-int — clean (the only ty diagnostics are the pre-existing pymilvus optional-extra imports).
  • tests/repository/test_openai_provider.py — 32 passed (incl. the 2 new tests: config forwarded to the provider; cache key changes with api_base and with api_key).
  • Full tests/repository sweep — 774 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_017STCpbNsYjZgUdftxgEAZ4

Signed-off-by: mikemikimike <13286568797@163.com>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-29T13:44:30.022423Z 9b9653e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 40942daa5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/repository/embedding_provider_factory.py
… settings

Codex review on #1370: semantic_embedding_api_base / api_key were still
described as LiteLLM-only in the Pydantic field descriptions and
docs/semantic-search.md, so the newly forwarded openai support was not
discoverable. Update both field descriptions, the config table rows, and
add an "OpenAI-compatible endpoints" subsection to the OpenAI provider
docs (llama.cpp / vLLM / TEI / LM Studio / Ollama) with a runnable
example and the dimensions/key caveats.

Refs #1336

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017STCpbNsYjZgUdftxgEAZ4
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 9b9653ef96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@phernandez
phernandez merged commit ba5b914 into main Aug 29, 2026
27 checks passed
@phernandez
phernandez deleted the fix/1336-openai-embedding-endpoint branch August 29, 2026 14:19
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] Let the openai embedding provider use semantic_embedding_api_base / api_key

2 participants