-
Notifications
You must be signed in to change notification settings - Fork 93
Fix IndexStats returning attribute names instead of values #1095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ def __init__(self, doc: Dict[str, Any]) -> None: | |
|
||
def __getattr__(self, attr: str) -> Any: | ||
if attr in self.__dict.keys(): | ||
return attr | ||
return self.__dict[attr] | ||
raise AttributeError(f"{self.__class__.__name__} object has no attribute {attr}") | ||
|
||
def __iter__(self) -> Iterator: | ||
|
@@ -62,3 +62,63 @@ class EmbedderDistribution(CamelBase): | |
class LocalizedAttributes(CamelBase): | ||
attribute_patterns: List[str] | ||
locales: List[str] | ||
|
||
|
||
class OpenAiEmbedder(CamelBase): | ||
source: str = "openAi" | ||
url: Optional[str] = None | ||
model: Optional[str] = None # Defaults to text-embedding-3-small | ||
dimensions: Optional[int] = None # Uses the model default | ||
api_key: Optional[str] = None # Can be provided through a CLI option or environment variable | ||
document_template: Optional[str] = None | ||
document_template_max_bytes: Optional[int] = None # Default to 400 | ||
distribution: Optional[EmbedderDistribution] = None | ||
binary_quantized: Optional[bool] = None | ||
|
||
|
||
class HuggingFaceEmbedder(CamelBase): | ||
source: str = "huggingFace" | ||
model: Optional[str] = None # Defaults to BAAI/bge-base-en-v1.5 | ||
revision: Optional[str] = None | ||
document_template: Optional[str] = None | ||
document_template_max_bytes: Optional[int] = None # Default to 400 | ||
distribution: Optional[EmbedderDistribution] = None | ||
binary_quantized: Optional[bool] = None | ||
|
||
|
||
class OllamaEmbedder(CamelBase): | ||
source: str = "ollama" | ||
url: Optional[str] = None | ||
api_key: Optional[str] = None | ||
model: str | ||
document_template: Optional[str] = None | ||
document_template_max_bytes: Optional[int] = None # Default to 400 | ||
distribution: Optional[EmbedderDistribution] = None | ||
binary_quantized: Optional[bool] = None | ||
|
||
|
||
class RestEmbedder(CamelBase): | ||
source: str = "rest" | ||
url: str | ||
api_key: Optional[str] # required for protected APIs | ||
document_template: Optional[str] = None | ||
document_template_max_bytes: Optional[int] = None # Default to 400 | ||
request: Dict[str, Any] | ||
response: Dict[str, Any] | ||
distribution: Optional[EmbedderDistribution] = None | ||
headers: Optional[Dict[str, Any]] = None | ||
binary_quantized: Optional[bool] = None | ||
|
||
|
||
class UserProvidedEmbedder(CamelBase): | ||
source: str = "userProvided" | ||
dimensions: int | ||
distribution: Optional[EmbedderDistribution] = None | ||
binary_quantized: Optional[bool] = None | ||
|
||
|
||
class Embedders(CamelBase): | ||
embedders: Dict[ | ||
str, | ||
Union[OpenAiEmbedder, HuggingFaceEmbedder, OllamaEmbedder, RestEmbedder, UserProvidedEmbedder], | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainPotential code duplication with existing embedder classes. The embedder classes defined here (OpenAiEmbedder, HuggingFaceEmbedder, OllamaEmbedder, RestEmbedder, UserProvidedEmbedder, Embedders) appear to duplicate functionality that already exists in Please verify if these classes are intended to replace the existing ones or if there's a different purpose for having them in both locations: 🏁 Script executed: #!/bin/bash
# Description: Check for duplicate embedder class definitions across the codebase
# Expected: Find if these classes exist in multiple files
echo "Searching for embedder class definitions..."
rg -A 2 "class.*Embedder.*CamelBase"
echo -e "\nSearching for Embedders container class..."
rg -A 2 "class Embedders" Length of output: 2856 Consolidate duplicate embedder definitions
Maintaining two copies will lead to drift and confusion. Please remove or de-duplicate one set of definitions—ideally centralizing all embedder models in 🧰 Tools🪛 Ruff (0.11.9)123-123: Undefined name (F821) 🤖 Prompt for AI Agents
|
Uh oh!
There was an error while loading. Please reload this page.