-
Notifications
You must be signed in to change notification settings - Fork 44
RAG OOP support #42
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
Merged
Merged
RAG OOP support #42
Changes from 37 commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
3cfe054
relevant changes
f3cb413
working changes
4f172c6
updating project and changelog
19b46fe
updating sample
3973ace
updating project
1846473
merging
2eb2b05
fixing build
5c65651
trying to have this not be flakey
5a7bd78
adding another sleep statement
34b44af
fixing warnings
3087680
fixing null refs
b3c0358
initial changes
78ddcf3
changes
880abf4
changing the project since it was giving a weird error before
e8f4a59
forgot to include model
ba0bb35
merging in
b56ac32
changes still not working
cd38280
got ingest email working
2a0ba9f
changes working for other function but still not working with new worker
93ef739
merging in changes from main
521c737
fixing sln file
50c2a40
changing some things back
8b751df
latest changes to get it compiling
378cb98
cleaning up project
5a68022
merge conflict
a744bcb
changes
3fdd375
adding localsettingsjson
cc197d1
fixing small mistake
edff897
comments
624f739
fixing alphabetic order
668fca2
Update CHANGELOG.md
aishwaryabh 9368d69
changes to input and output binding
424c708
Merge branch 'aibhandari/rag-semantic-support' of https://github.com/…
9edc60d
finally works after so long
daf11d0
trying out pipeline change
3aa1dea
trying another pipeline change
a6a7a57
build still not working
43b4359
change
7cc13c7
updating small thing
d0625da
trying out new package
1aa8076
changing condition
39c947e
trying again
32627f3
forgot to remove quote
678c247
another change in yaml file
899d4bf
adding config file
9c18d20
figuring out which directory we're in
8c75c19
forgot root ref
1a6c738
just tryna get to etc directory
ffcf634
change
1b8ff00
trying again
75d7d99
trying again
2b12e9a
this already exists
b546402
tryign user level
da8c996
lol trying again
8fc712d
trying diff path
5b76e68
found nuget path fr
eb02739
trying again
71c4d66
getting rid of extra dependency package
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
samples/rag-aisearch/csharp-inproc/SemanticAISearchEmbeddings.csproj
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Net; | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using Microsoft.Azure.Functions.Worker; | ||
| using Microsoft.Azure.Functions.Worker.Extensions.OpenAI.Embeddings; | ||
| using Microsoft.Azure.Functions.Worker.Extensions.OpenAI.Search; | ||
| using Microsoft.Azure.Functions.Worker.Http; | ||
|
|
||
| namespace SemanticAISearchEmbeddings; | ||
|
|
||
| public static class FilePrompt | ||
| { | ||
| public class EmbeddingsRequest | ||
| { | ||
| [JsonPropertyName("FilePath")] | ||
| public string? FilePath { get; set; } | ||
| } | ||
|
|
||
| public class SemanticSearchRequest | ||
| { | ||
| [JsonPropertyName("Prompt")] | ||
| public string? Prompt { get; set; } | ||
| } | ||
|
|
||
| // REVIEW: There are several assumptions about how the Embeddings binding and the SemanticSearch bindings | ||
| // work together. We should consider creating a higher-level of abstraction for this. | ||
| [Function("IngestFile")] | ||
| public static async Task<SemanticSearchOutputResponse> IngestFile( | ||
| [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, | ||
| [EmbeddingsInput("{FilePath}", InputType.FilePath, Model = "%EMBEDDING_MODEL_DEPLOYMENT_NAME%")] EmbeddingsContext embeddings) | ||
| { | ||
| using StreamReader reader = new(req.Body); | ||
| string request = await reader.ReadToEndAsync(); | ||
|
|
||
| EmbeddingsRequest? requestBody = JsonSerializer.Deserialize<EmbeddingsRequest>(request); | ||
|
|
||
| if (requestBody == null) | ||
| { | ||
| throw new ArgumentException("Invalid request body. Make sure that you pass in {\"filePath\": value } as the request body."); | ||
| } | ||
|
|
||
| string title = Path.GetFileNameWithoutExtension(requestBody.FilePath); | ||
|
|
||
| HttpResponseData response = req.CreateResponse(HttpStatusCode.OK); | ||
| await response.WriteAsJsonAsync(new { status = "success", title, chunks = embeddings.Count }); | ||
|
|
||
| return new SemanticSearchOutputResponse | ||
| { | ||
| HttpResponse = response, | ||
| SearchableDocument = new SearchableDocument(title, embeddings) | ||
| }; | ||
| } | ||
|
|
||
| public class SemanticSearchOutputResponse | ||
| { | ||
| [SemanticSearchOutput("AISearchEndpoint", "openai-index", CredentialSettingName = "SearchAPIKey", EmbeddingsModel = "%EMBEDDING_MODEL_DEPLOYMENT_NAME%")] | ||
| public SearchableDocument SearchableDocument { get; set; } | ||
|
|
||
| public HttpResponseData? HttpResponse { get; set; } | ||
| } | ||
|
|
||
| [Function("PromptFile")] | ||
| public static IActionResult PromptFile( | ||
| [HttpTrigger(AuthorizationLevel.Function, "post")] SemanticSearchRequest unused, | ||
| [SemanticSearchInput("AISearchEndpoint", "openai-index", CredentialSettingName = "SearchAPIKey", Query = "{Prompt}", ChatModel = "%CHAT_MODEL_DEPLOYMENT_NAME%", EmbeddingsModel = "%EMBEDDING_MODEL_DEPLOYMENT_NAME%")] SemanticSearchContext result) | ||
| { | ||
| return new ContentResult { Content = result.Response, ContentType = "text/plain" }; | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.