Skip to content

Conversation

@patniko
Copy link
Contributor

@patniko patniko commented Jan 29, 2026

No description provided.

- Add Custom Providers section to Node.js, Go, and Python READMEs
- Document ProviderConfig options with examples for Ollama, OpenAI-compatible APIs, and Azure OpenAI
- Add SessionConfig documentation with provider option
- Highlight important notes:
  - Model is required when using custom providers
  - Azure endpoints require type 'azure', not 'openai'
  - Base URL should not include /openai/v1 path
Copilot AI review requested due to automatic review settings January 29, 2026 16:49
@patniko patniko requested a review from a team as a code owner January 29, 2026 16:49
@patniko patniko merged commit ea2a69a into main Jan 29, 2026
22 of 23 checks passed
@patniko patniko deleted the provider-info branch January 29, 2026 16:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the language SDK READMEs to document session configuration options for BYOK/custom providers (including Azure) and adds custom provider usage examples.

Changes:

  • Add provider/custom provider documentation and examples (Python/Node/Go).
  • Clarify session config fields (notably model) in each README.
  • Add Azure-specific provider guidance (type, base URL shape, API version).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
python/README.md Adds SessionConfig bullets plus a new “Custom Providers” section with Python examples and Azure notes.
nodejs/README.md Updates createSession config docs and adds a “Custom Providers” section with TS examples and Azure notes.
go/README.md Adds SessionConfig/ResumeSessionConfig bullets and a “Custom Providers” section with Go examples and Azure notes.
Comments suppressed due to low confidence (4)

python/README.md:349

  • These “Important notes” claim the SDK throws/returns an error if model is omitted with a custom provider, but the SDK currently forwards provider without validating model (and tests cover provider-only configs). Either remove/soften this guarantee (e.g., “the server may require…”) or add explicit validation in create_session/createSession/CreateSession to actually throw.
> **Important notes:**
> - When using a custom provider, the `model` parameter is **required**. The SDK will throw an error if no model is specified.
> - For Azure OpenAI endpoints (`*.openai.azure.com`), you **must** use `type: "azure"`, not `type: "openai"`.

nodejs/README.md:90

  • The new docs say model is required when using a custom provider, but the Node SDK currently sends model: config.model without enforcing that it is present when provider is set, and e2e tests use a provider without a model. Please align the docs with actual behavior or add validation in createSession.
- `model?: string` - Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
- `tools?: Tool[]` - Custom tools exposed to the CLI

nodejs/README.md:423

  • azure?.apiVersion?: string isn’t valid TypeScript and doesn’t match the actual ProviderConfig shape (it’s azure?: { apiVersion?: string } in nodejs/src/types.ts). Please update this bullet to reflect the nested object.
- `azure?.apiVersion?: string` - Azure API version (default: "2024-10-21")

go/README.md:108

  • This new SessionConfig bullet list looks like an API reference, but it omits several existing SessionConfig fields from go/types.go (e.g., ConfigDir, AvailableTools, ExcludedTools, OnPermissionRequest, MCPServers, CustomAgents, SkillDirectories, DisabledSkills). Either document the full struct here or explicitly label this list as non-exhaustive to avoid misleading readers.
**SessionConfig:**

- `Model` (string): Model to use ("gpt-5", "claude-sonnet-4.5", etc.). **Required when using custom provider.**
- `SessionID` (string): Custom session ID
- `Tools` ([]Tool): Custom tools exposed to the CLI
- `SystemMessage` (\*SystemMessageConfig): System message configuration
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
- `Streaming` (bool): Enable streaming delta events
- `InfiniteSessions` (\*InfiniteSessionConfig): Automatic context compaction configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


## Custom Providers

The SDK supports custom OpenAI-compatible API providers (BYOK - Bring Your Own Key), including local providers like Ollama. When using a custom provider, you must specify the `model` explicitly.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The docs state that when using a custom provider you must specify model and that the SDK will throw an error otherwise, but the SDK currently allows creating sessions with provider and no model (e.g., python/e2e/test_session.py creates a session with provider only). Please update this text to match actual behavior, or implement/enforce this validation in the SDK if it is truly required.

Copilot uses AI. Check for mistakes.

> **Note:** When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
> **Important notes:**
> - When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

This section states that model is required for custom providers and that the SDK will throw/return an error if it’s missing, but the Go SDK currently allows creating/resuming sessions with a Provider and an empty Model (and tests cover provider-only configs). Please update the docs to match, or add validation in the client to enforce the requirement.

Suggested change
> - When using a custom provider, the `Model` parameter is **required**. The SDK will return an error if no model is specified.
> - When using a custom provider, specifying the `Model` parameter is **recommended**, but the Go SDK does **not** currently enforce it. If you omit `Model`, behavior (such as using a provider-specific default model or returning an error) depends on your configured provider.

Copilot uses AI. Check for mistakes.
Comment on lines +329 to +342
**Example with Azure OpenAI:**

```python
import os

session = await client.create_session({
"model": "gpt-4",
"provider": {
"type": "azure", # Must be "azure" for Azure endpoints, NOT "openai"
"base_url": "https://my-resource.openai.azure.com", # Just the host, no path
"api_key": os.environ["AZURE_OPENAI_KEY"],
"azure": {
"api_version": "2024-10-21",
},
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

PR title mentions “need version for Azure Foundry”, but the added documentation focuses on BYOK/custom providers and doesn’t mention Azure Foundry-specific versioning requirements beyond the generic api_version example/default. Please adjust the title or add the missing Azure Foundry guidance so the PR intent matches the content.

Copilot uses AI. Check for mistakes.
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.

4 participants