Skip to content

Conversation

@axl1313
Copy link
Contributor

@axl1313 axl1313 commented Dec 29, 2025

Increases test coverage to 70%

@axl1313 axl1313 requested a review from kelsey-wong December 29, 2025 23:21
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
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

"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?
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

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.

3 participants