Skip to content
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

Address vector dimension mismatch when using ollama with Azure AI Search #6001

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

artl93
Copy link
Member

@artl93 artl93 commented Feb 28, 2025

  • Added a condition to set the vector dimension when using ollama with Azure AI Search
  • Added a note that the user may need to delete an old index
Microsoft Reviewers: Open in CodeFlow

Azure AI Search may fail to ingest new data if the vector dimensionality mismatches. This may cause an issue if you have data from prior runs with a different embedding model.
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR addresses the vector dimension mismatch when using ollama with Azure AI Search by conditionally setting the vector size and updating the README with an index deletion note.

  • Added a compilation condition to set a vector dimension of 384 for ollama versus 1536 for the OpenAI model.
  • Inserted a warning note in the README for users to potentially delete an old index if switching models.

Reviewed Changes

File Description
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData.Web/Services/SemanticSearchRecord.cs Added conditional attribute to set vector dimension based on the ollama compilation symbol.
src/ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData.Web/README.md Updated the documentation with a note regarding potential index deletion due to vector dimension mismatch.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot <[email protected]>
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.

1 participant