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

Add Azure Embeddings Model Interface implementation #116

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

IRooc
Copy link
Contributor

@IRooc IRooc commented Jan 26, 2024

This adds the Azure Embedding option so the demo in the readme works with the Azure OpenAI Api.

Example usage

 var documents = await PdfPigPdfSource.FromUriAsync(
        new Uri("https://canonburyprimaryschool.co.uk/wp-content/uploads/2016/01/Joanne-K.-Rowling-Harry-Potter-Book-1-Harry-Potter-and-the-Philosophers-Stone-EnglishOnlineClub.com_.pdf"));
 
 // This adds embedding possibility for the Azure Model  
 var embeddingModel = new AzureOpenAIModel("AZUREAPI_KEY","AZUREAPI_ENDPOINT", "EMBEDDING_DEPLOYMENT");
 var store = await InMemoryVectorStore.CreateIndexFromDocuments(embeddingModel, documents);

 var similarDocuments = await store.Store.GetSimilarDocuments(query, amount: 5);

 // use the documents in a prompt call
 var partialPrompt = similarDocuments.AsString();

I tried to mirror the OpenAI setup, and tested it succesfully on an Azure deployment.

@CLAassistant
Copy link

CLAassistant commented Jan 26, 2024

CLA assistant check
All committers have signed the CLA.

@HavenDV HavenDV enabled auto-merge (squash) January 26, 2024 20:34
@HavenDV HavenDV merged commit 26b21ac into tryAGI:main Jan 26, 2024
2 checks passed
@HavenDV
Copy link
Contributor

HavenDV commented Jan 26, 2024

@all-contributors please add @IRooc for infrastructure, tests and code

Copy link
Contributor

@HavenDV

I've put up a pull request to add @IRooc! 🎉

@HavenDV
Copy link
Contributor

HavenDV commented Jan 26, 2024

Thank you very much for your contribution. Please write me your name in discord if you want and I will add you to the list of contrubutors and dev channel discussing development and immediate plans

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