Skip to content
Prev Previous commit
Next Next commit
feat(chroma): fix health check and base URL construction for CI stabi…
…lity
  • Loading branch information
ali-Hamza817 authored and Laurianti committed Oct 7, 2026
commit 69f7e5a27a5c31ee0d1a299204dcbee49ae7fc2b
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ private static ChromaClient CreateClient(IServiceProvider sp, ChromaClientSettin
}

var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(connectionName);
return new ChromaClient(new ChromaConfigurationOptions(settings.Endpoint.ToString()), httpClient);
var endpoint = settings.Endpoint.ToString();

if (!endpoint.Contains("/api/v1", StringComparison.OrdinalIgnoreCase))
{
endpoint = endpoint.TrimEnd('/') + "/api/v1/";
}

return new ChromaClient(new ChromaConfigurationOptions(endpoint), httpClient);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public static IResourceBuilder<ChromaResource> AddChroma(
return builder.AddResource(chroma)
.WithImage(ChromaContainerImageTags.Image, ChromaContainerImageTags.Tag)
.WithImageRegistry(ChromaContainerImageTags.Registry)
.WithHttpEndpoint(targetPort: ChromaPort, port: port, name: ChromaResource.PrimaryEndpointName);
.WithHttpEndpoint(targetPort: ChromaPort, port: port, name: ChromaResource.PrimaryEndpointName)
.WithHttpHealthCheck("/api/v1/heartbeat");
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public class ChromaResource(string name) : ContainerResource(name), IResourceWit
/// Gets the connection string expression for the ChromaDB
/// </summary>
public ReferenceExpression ConnectionStringExpression =>
ReferenceExpression.Create($"Endpoint=http://{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}");
ReferenceExpression.Create($"Endpoint=http://{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}/api/v1/");

/// <summary>
/// Gets the connection URI expression for the ChromaDB server.
/// </summary>
/// <remarks>
/// Format: <c>http://{host}:{port}</c>.
/// Format: <c>http://{host}:{port}/api/v1/</c>.
/// </remarks>
public ReferenceExpression UriExpression => ReferenceExpression.Create($"http://{Host}:{Port}");
public ReferenceExpression UriExpression => ReferenceExpression.Create($"http://{Host}:{Port}/api/v1/");

IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties()
{
Expand Down