-
Notifications
You must be signed in to change notification settings - Fork 767
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
AI Templates - Fixes for Ollama and OpenAI scenarios #5855
base: main
Are you sure you want to change the base?
Conversation
@@ -52,7 +56,7 @@ | |||
chatSuggestions?.Clear(); | |||
await chatInput!.FocusAsync(); | |||
|
|||
#if (IsOllama) | |||
@*#if (IsOllama) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong, but it is the conditional syntax used by the templating engine for .razor files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the syntax here isn't quite right because it will break the application if you run it directly from sources here. Note that in VS it's displayed like this:
That is, both branches of the if/else are greyed out, because as far as Razor syntax is concerned, this is all just one big comment block. So if you run the application like this, neither branch will execute and the app won't work. This will block us from being able to work on the application code directly. It's just by luck that it even still compiles.
I think what we need is the following syntax instead:
Now Razor itself sees the Ollama part of the code as being a comment, and the rest as being real code. So the app will still work if we run it directly from sources.
I think at least that the dotnet new
templating system will also understand this as an if/else and emit the desired code in both cases. (Update: yes, I verified it does)
@@ -40,8 +40,11 @@ public async Task IngestDataAsync(IIngestionSource source) | |||
{ | |||
logger.LogInformation("Processing {file}", modifiedDoc.Id); | |||
|
|||
await vectorCollection.DeleteBatchAsync(modifiedDoc.Records.Select(r => r.Id)); | |||
|
|||
if (modifiedDoc.Records.Count > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, Azure AI Search integration breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks.
The previous version of this check seemed to have the braces in a different place and was suppressing the CreateRecordsForDocumentAsync
call as well, but maybe something weird happened in the Git merge.
In any case this version of the check looks totally safe!
🎉 Good job! The coverage increased 🎉
Full code coverage report: https://dev.azure.com/dnceng-public/public/_build/results?buildId=943766&view=codecoverage-tab |
Use the search tool to find relevant information. When you do this, end your | ||
reply with citations in the special XML format: | ||
|
||
<citation filename='string' page_number='number'>exact quote here</citation> | ||
|
||
Always include the citation in your response if there are results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nbd but something quirky about the indentation. Not sure if it's a tabs/spaces thing:
Use the search tool to find relevant information. When you do this, end your | |
reply with citations in the special XML format: | |
<citation filename='string' page_number='number'>exact quote here</citation> | |
Always include the citation in your response if there are results. | |
Use the search tool to find relevant information. When you do this, end your | |
reply with citations in the special XML format: | |
<citation filename='string' page_number='number'>exact quote here</citation> | |
Always include the citation in your response if there are results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes several issues for the different combinations of environment choices:
using Azure
statement)Microsoft Reviewers: Open in CodeFlow