-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hello!
I am working on updating the Semantic Kernel connector for Pinecone to use the official SDK: microsoft/semantic-kernel#10415
The first step that I tried to take was to setup a test container to use the local emulator so I could write some integration tests.
Here is the code I have:
using DotNet.Testcontainers.Builders;
using Pinecone;
namespace PineconeLocalRepro
{
internal class Program
{
static async Task Main(string[] args)
{
// Values taken from https://docs.pinecone.io/guides/operations/local-development
const string Image = "ghcr.io/pinecone-io/pinecone-local:latest";
const ushort HttpPort = 5080;
const string Host = "localhost";
var container = new ContainerBuilder()
.WithImage(Image)
.WithPortBinding(HttpPort, assignRandomHostPort: true)
.WithEnvironment("PINECONE_HOST", "localhost")
.WithEnvironment("PORT", HttpPort.ToString())
.Build();
await container.StartAsync();
await Task.Delay(TimeSpan.FromSeconds(3)); // add some artificial delay
string url = $"http://{container.Hostname}:{container.GetMappedPublicPort(HttpPort)}";
Console.WriteLine($"Using URL: '{url}'");
var pc = new PineconeClient("pclocal",
new ClientOptions
{
BaseUrl = url,
IsTlsEnabled = false
}
);
await pc.ListCollectionsAsync();
var collectionModel = await pc.CreateCollectionAsync(new CreateCollectionRequest
{
Name = "example-collection",
Source = "example-index",
});
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pinecone.Client" Version="3.0.0" />
<PackageReference Include="Testcontainers" Version="4.3.0" />
</ItemGroup>
</Project>
I keeps failing with "The response ended prematurely":
Using URL: 'http://127.0.0.1:63815'
Unhandled exception. System.Net.Http.HttpRequestException: An error occurred while sending the request.
---> System.Net.Http.HttpIOException: The response ended prematurely. (ResponseEnded)
at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken o
at Pinecone.Core.RawClient.SendWithRetriesAsync(BaseApiRequest request, CancellationToken cancellationToken)
at Pinecone.Core.RawClient.MakeRequestAsync(BaseApiRequest request, CancellationToken cancellationToken)
at Pinecone.BasePinecone.ListCollectionsAsync(RequestOptions options, CancellationToken cancellationToken)
at PineconeLocalRepro.Program.Main(String[] args) in C:\Users\adsitnik\source\repos\PineconeLocalRepro\Program.cs:line 37
at PineconeLocalRepro.Program.<Main>(String[] args)
am I doing something wrong?
Metadata
Metadata
Assignees
Labels
No labels