Skip to content

Conversation

@gshahbazian
Copy link
Contributor

Defaults them to api.trychroma.com at 443

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Dec 9, 2025

Expose configurable host/port in cloud JS clients

Adds optional host and port parameters to the constructors for CloudClient and AdminCloudClient, allowing callers to override the default endpoint. Defaults now resolve to api.trychroma.com on port 443, replacing the prior hard-coded port 8000.

Key Changes

• Extended CloudClient constructor args to include optional host and port fields with documentation
• Passes args.host || "api.trychroma.com" and args.port || 443 into the super call for both cloud client classes
• Mirrors optional host and port handling in AdminCloudClient constructor args and initialization

Affected Areas

• clients/new-js/packages/chromadb/src/cloud-client.ts

This summary was automatically generated by @propel-code-bot

Comment on lines 67 to 76
args: Partial<{
/** API key for authentication (or set CHROMA_API_KEY env var) */
apiKey?: string;
/** Host address of the Chroma cloud server. Defaults to 'api.trychroma.com' */
host?: string;
/** Port number of the Chroma cloud server. Defaults to 443 */
port?: number;
/** Additional fetch options for HTTP requests */
fetchOptions?: RequestInit;
}> = {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended

[Maintainability] To improve maintainability and reduce code duplication, consider defining a shared interface for the cloud client constructor arguments. Both CloudClient and AdminCloudClient now share several configuration options (apiKey, host, port, fetchOptions).

You could create a base interface for these common options and then extend it for CloudClient, which has additional properties.

For example:

interface BaseCloudClientArgs {
  /** API key for authentication (or set CHROMA_API_KEY env var) */
  apiKey?: string;
  /** Host address of the Chroma cloud server. Defaults to 'api.trychroma.com' */
  host?: string;
  /** Port number of the Chroma cloud server. Defaults to 443 */
  port?: number;
  /** Additional fetch options for HTTP requests */
  fetchOptions?: RequestInit;
}

interface CloudClientArgs extends BaseCloudClientArgs {
  /** Tenant name for multi-tenant deployments */
  tenant?: string;
  /** Database name to connect to */
  database?: string;
}

This would allow you to use Partial<CloudClientArgs> and Partial<BaseCloudClientArgs> in the respective constructors, making the code more DRY.

Context for Agents
To improve maintainability and reduce code duplication, consider defining a shared interface for the cloud client constructor arguments. Both `CloudClient` and `AdminCloudClient` now share several configuration options (`apiKey`, `host`, `port`, `fetchOptions`).

You could create a base interface for these common options and then extend it for `CloudClient`, which has additional properties.

For example:
```typescript
interface BaseCloudClientArgs {
  /** API key for authentication (or set CHROMA_API_KEY env var) */
  apiKey?: string;
  /** Host address of the Chroma cloud server. Defaults to 'api.trychroma.com' */
  host?: string;
  /** Port number of the Chroma cloud server. Defaults to 443 */
  port?: number;
  /** Additional fetch options for HTTP requests */
  fetchOptions?: RequestInit;
}

interface CloudClientArgs extends BaseCloudClientArgs {
  /** Tenant name for multi-tenant deployments */
  tenant?: string;
  /** Database name to connect to */
  database?: string;
}
```

This would allow you to use `Partial<CloudClientArgs>` and `Partial<BaseCloudClientArgs>` in the respective constructors, making the code more DRY.

File: clients/new-js/packages/chromadb/src/cloud-client.ts
Line: 76

super({
host: "api.trychroma.com",
port: 8000,
host: args.host ?? "api.trychroma.com",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use || here to handle empty string fallback

@gshahbazian gshahbazian enabled auto-merge (squash) December 9, 2025 20:23
@gshahbazian gshahbazian merged commit 8963e1d into main Dec 9, 2025
63 checks passed
@gshahbazian gshahbazian deleted the gabe/cloud-init-host branch December 9, 2025 21:18
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