Skip to content

[BUG] Update HF EF base URL#6907

Open
kylediaz wants to merge 1 commit intomainfrom
hf-ef-api-base
Open

[BUG] Update HF EF base URL#6907
kylediaz wants to merge 1 commit intomainfrom
hf-ef-api-base

Conversation

@kylediaz
Copy link
Copy Markdown
Contributor

@kylediaz kylediaz commented Apr 14, 2026

import chromadb

import chromadb.utils.embedding_functions as embedding_functions
huggingface_ef = embedding_functions.HuggingFaceEmbeddingFunction(
    api_key="...",
    model_name="sentence-transformers/all-MiniLM-L6-v2" # and embeddinggemma
)

client = chromadb.Client()
collection = client.create_collection("test", embedding_function=huggingface_ef)

collection.add(
    documents=["Hello, world!", "Hello, world!", "Hello, world!"],
    metadatas=[{"source": "test"}, {"source": "test"}, {"source": "test"}],
    ids=["1", "2", "3"],
)

results = collection.query(
    query_texts=["Hello, world!"],
    n_results=2,
)
print(results)
  • add a base_url param so users can override in case this happens again in the future. this param is optional, so it should not break config backwards compatibility. existing EF configs have this config option unset, so it should use the default endpoint (the now correct one)

Stack created with GitHub Stacks CLIGive Feedback 💬

@propel-code-bot
Copy link
Copy Markdown
Contributor

Add configurable base_url for HuggingFace embeddings and switch default to router endpoint

This PR updates the HuggingFace embedding function to support a configurable base_url and changes the default endpoint from the legacy inference URL to https://router.huggingface.co/. The API URL construction now derives from base_url and model_name, targeting the router path for feature extraction.

The schema and config serialization/deserialization were updated to include base_url, ensuring the new setting can be validated, loaded via build_from_config, and persisted via get_config.

This summary was automatically generated by @propel-code-bot

@github-actions
Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@kylediaz kylediaz requested a review from itaismith April 14, 2026 21:51
Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

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

No issues were identified; changes appear correct, backward-compatible, and appropriately scoped.

Status: No Issues Found | Risk: Low

Review Details

📁 2 files reviewed | 💬 0 comments

@blacksmith-sh

This comment has been minimized.

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.

2 participants