Code:
var llmEndPoint = "http://localhost:11434";
var llmUri = new Uri(llmEndPoint);
var modelId = "phi3:medium";
var embedderModelId = "nomic-embed-text";
var builder = Kernel.CreateBuilder()
.AddOpenAIChatCompletion(modelId, llmUri, null)
.AddOllamaTextEmbeddingGeneration(embedderModelId, llmUri);
builder.Services.AddTransient();
var kernel = builder.Build();
var embeddingGenerator = kernel.GetRequiredService>();
var embeddings = await embeddingGenerator.GenerateEmbeddingAsync("What is the capital of France?");
Error:
System.Text.Json.JsonException: ''p' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 0 | BytePositionInLine: 4.'
Http Response:
StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent
Cause: There is a trailing / when using Uri object
Expected: http://localhost:11434/api/embeddings
Actual: http://localhost:11434//api/embeddings
Code:
var llmEndPoint = "http://localhost:11434"; var llmUri = new Uri(llmEndPoint); var modelId = "phi3:medium"; var embedderModelId = "nomic-embed-text"; var builder = Kernel.CreateBuilder() .AddOpenAIChatCompletion(modelId, llmUri, null) .AddOllamaTextEmbeddingGeneration(embedderModelId, llmUri); builder.Services.AddTransient(); var kernel = builder.Build(); var embeddingGenerator = kernel.GetRequiredService>(); var embeddings = await embeddingGenerator.GenerateEmbeddingAsync("What is the capital of France?");Error:
System.Text.Json.JsonException: ''p' is invalid after a single JSON value. Expected end of data. Path: $ | LineNumber: 0 | BytePositionInLine: 4.'Http Response:
StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContentCause: There is a trailing / when using Uri object
Expected:
http://localhost:11434/api/embeddingsActual:
http://localhost:11434//api/embeddings