fix: add missing name() method to WatsonEmbeddingFunction

Fixes #3597 - ChromaDB expects embedding functions to have a name() method
for validation. Added static method that returns 'watson' following the
same pattern as other embedding functions.

- Added comprehensive tests to verify the fix
- Ensures compatibility with ChromaDB validation requirements
- No regressions in existing Watson embedding functionality

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-09-26 10:52:54 +00:00
parent b5b10a8cde
commit 9578b60734
2 changed files with 80 additions and 0 deletions

View File

@@ -152,3 +152,8 @@ class WatsonEmbeddingFunction(EmbeddingFunction[Documents]):
except Exception as e:
print(f"Error during Watson embedding: {e}")
raise
@staticmethod
def name() -> str:
"""Return the name identifier for this embedding function."""
return "watson"