Open
Conversation
kelsey-wong
reviewed
Dec 30, 2025
Comment on lines
+28
to
+42
| # Create a mock OpenAI client with embeddings.create method | ||
| mock_openai_client = MagicMock() | ||
| embedding_calls: list[tuple[str, str]] = [] | ||
|
|
||
| async def mock_embeddings_create(input: str, model: str, timeout: float) -> MagicMock: | ||
| embedding_calls.append((input, model)) | ||
| response = MagicMock() | ||
| response.data = [MagicMock(embedding=fake_embedding(input, 3))] | ||
| return response | ||
|
|
||
| mock_openai_client.embeddings.create = mock_embeddings_create | ||
|
|
||
| @asynccontextmanager | ||
| async def mock_get_openai_client(): | ||
| yield mock_openai_client |
Collaborator
There was a problem hiding this comment.
can this functionality be refactored into a patch function similar to the patch_acompletion in litellm_patches.py so that it can be easily reused across tests?
kelsey-wong
reviewed
Dec 30, 2025
| "The quick brown fox jumps over the lazy dog.", | ||
| "The swift black cat hops around the sleepy frog.", | ||
| 1 / 8, | ||
| ), # is there a reason why we don't ignore capitalization? |
Collaborator
There was a problem hiding this comment.
I think I asked about this before, will defer to @huiwengoh, but this case sensitivity logic is ported over from SaaS. maybe because capitalization can indicated differences e.g. proper nouns? but I also think that this similarity method is a worst-case scenario fallback so it's not meant to be very sophisticated. other methods like LLM as a judge are used primarily.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Increases test coverage to 70%