Skip to content

Under Add the app code, section 3 - AsEmbeddingGenerator extension method is missing #45512

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

Closed
anuraj opened this issue Mar 26, 2025 · 0 comments · Fixed by #45659
Closed

Under Add the app code, section 3 - AsEmbeddingGenerator extension method is missing #45512

anuraj opened this issue Mar 26, 2025 · 0 comments · Fixed by #45659

Comments

@anuraj
Copy link

anuraj commented Mar 26, 2025

Type of issue

Code doesn't work

Description

The current code block is like this

// Load the configuration values
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
string endpoint = config["AZURE_OPENAI_ENDPOINT"];
string model = config["AZURE_OPENAI_GPT_NAME"];

// Create the embedding generator
IEmbeddingGenerator<string, Embedding<float>> generator =
    new AzureOpenAIClient(
        new Uri(endpoint),
        new DefaultAzureCredential())

But this code won't work because the AsEmbeddingGenerator() method is missing.

It should be something like this.

IEmbeddingGenerator<string, Embedding<float>> generator =
    new AzureOpenAIClient(
        new Uri(endpoint),
        new DefaultAzureCredential())
        .AsEmbeddingGenerator("text-embedding-ada-002");

Page URL

https://learn.microsoft.com/en-us/dotnet/ai/quickstarts/build-vector-search-app?tabs=azd

Content source URL

https://github.com/dotnet/docs/blob/main/docs/ai/quickstarts/build-vector-search-app.md

Document Version Independent Id

f03733f1-dcfe-f4ad-447d-61cd1b240b33

Platform Id

d1c9fb28-bcac-d830-c091-f0ae200a9dcf

Article author

@FBoucher

Metadata

  • ID: 60884e6c-fc32-1775-2561-a841c357206f
  • PlatformId: d1c9fb28-bcac-d830-c091-f0ae200a9dcf
  • Service: dotnet
  • Sub-service: intelligent-apps

Related Issues

@dotnet-policy-service dotnet-policy-service bot added the ⌚ Not Triaged Not triaged label Mar 26, 2025
@gewarren gewarren self-assigned this Apr 2, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Apr 8, 2025
@gewarren gewarren moved this from 🔖 Ready to 🏗 In progress in dotnet/docs April 2025 sprint project Apr 8, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Apr 8, 2025
@dotnetrepoman dotnetrepoman bot added the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Apr 8, 2025
@gewarren gewarren moved this from 🏗 In progress to 👀 In review in dotnet/docs April 2025 sprint project Apr 8, 2025
@dotnet-policy-service dotnet-policy-service bot removed the 🗺️ mapQUEST Only used as a way to mark an issue as updated for quest. RepoMan should instantly remove it. label Apr 8, 2025
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in dotnet/docs April 2025 sprint project Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants