Skip to content

Commit 726a2e6

Browse files
Rename MaxPromptTokens to MaxInputTokens and clarify ProviderConfig docs
Renames the SDK-facing ProviderConfig field across all four languages while preserving the wire JSON key as maxPromptTokens: - .NET: MaxPromptTokens -> MaxInputTokens (JsonPropertyName unchanged) - Go: MaxPromptTokens -> MaxInputTokens (json tag unchanged) - Python: max_prompt_tokens -> max_input_tokens (wire conversion in _convert_provider_to_wire_format unchanged) - Node: maxPromptTokens -> maxInputTokens; adds a small toWireProviderConfig helper in client.ts that remaps the field before sending session.create / session.resume. Also rewrites the doc comments for modelId, wireModel, maxInputTokens, and maxOutputTokens to make the priority order clear: WireModel falls back to ModelId falls back to SessionConfig.Model, and ModelId drives both runtime configuration lookup and the wire model when WireModel is unset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 56af92f commit 726a2e6

10 files changed

Lines changed: 84 additions & 86 deletions

File tree

dotnet/src/Types.cs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,38 +1530,35 @@ public class ProviderConfig
15301530
public IDictionary<string, string>? Headers { get; set; }
15311531

15321532
/// <summary>
1533-
/// Well-known model ID used to look up agent configuration (tools, prompts,
1534-
/// reasoning behavior) and default token limits from the capability catalog.
1535-
/// Useful for fine-tuned models that should inherit the configuration of a
1536-
/// known base model.
1537-
/// Defaults to the session's configured model (see <see cref="SessionConfig.Model"/>)
1538-
/// when not explicitly set.
1533+
/// Well-known model name used by the runtime to look up agent configuration
1534+
/// (tools, prompts, reasoning behavior) and default token limits. Also used
1535+
/// as the wire model when <see cref="WireModel"/> is not set.
1536+
/// Falls back to <see cref="SessionConfig.Model"/>.
15391537
/// </summary>
15401538
[JsonPropertyName("modelId")]
15411539
public string? ModelId { get; set; }
15421540

15431541
/// <summary>
1544-
/// Model identifier sent to the provider API for inference.
1545-
/// Use this when the name your provider knows (e.g. an Azure deployment name
1546-
/// or a custom fine-tune name) differs from the well-known model ID used for
1547-
/// configuration lookup.
1548-
/// Defaults to the session's configured model (see <see cref="SessionConfig.Model"/>)
1549-
/// when not explicitly set.
1542+
/// Model name sent to the provider API for inference. Use this when the
1543+
/// provider's model name (e.g. an Azure deployment name or a custom
1544+
/// fine-tune name) differs from <see cref="ModelId"/>.
1545+
/// Falls back to <see cref="ModelId"/>, then <see cref="SessionConfig.Model"/>.
15501546
/// </summary>
15511547
[JsonPropertyName("wireModel")]
15521548
public string? WireModel { get; set; }
15531549

15541550
/// <summary>
1555-
/// Maximum number of tokens allowed in the prompt for a single LLM API request.
1556-
/// Used by the runtime to trigger conversation compaction before sending a request
1557-
/// when the prompt (system message, history, tool definitions, user message) exceeds this limit.
1551+
/// Overrides the resolved model's default max prompt tokens. The runtime
1552+
/// triggers conversation compaction before sending a request when the
1553+
/// prompt (system message, history, tool definitions, user message) would
1554+
/// exceed this limit.
15581555
/// </summary>
15591556
[JsonPropertyName("maxPromptTokens")]
1560-
public int? MaxPromptTokens { get; set; }
1557+
public int? MaxInputTokens { get; set; }
15611558

15621559
/// <summary>
1563-
/// Maximum number of tokens the model can generate in a single response.
1564-
/// When hit, the model stops generating and returns a truncated response.
1560+
/// Overrides the resolved model's default max output tokens. When hit, the
1561+
/// model stops generating and returns a truncated response.
15651562
/// </summary>
15661563
[JsonPropertyName("maxOutputTokens")]
15671564
public int? MaxOutputTokens { get; set; }

dotnet/test/Unit/SerializationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void ProviderConfig_CanSerializeHeaders_WithSdkOptions()
2323
Headers = new Dictionary<string, string> { ["Authorization"] = "Bearer provider-token" },
2424
ModelId = "gpt-4o",
2525
WireModel = "my-finetune-v3",
26-
MaxPromptTokens = 100_000,
26+
MaxInputTokens = 100_000,
2727
MaxOutputTokens = 4096
2828
};
2929

@@ -43,7 +43,7 @@ public void ProviderConfig_CanSerializeHeaders_WithSdkOptions()
4343
Assert.Equal("Bearer provider-token", deserialized.Headers!["Authorization"]);
4444
Assert.Equal("gpt-4o", deserialized.ModelId);
4545
Assert.Equal("my-finetune-v3", deserialized.WireModel);
46-
Assert.Equal(100_000, deserialized.MaxPromptTokens);
46+
Assert.Equal(100_000, deserialized.MaxInputTokens);
4747
Assert.Equal(4096, deserialized.MaxOutputTokens);
4848
}
4949

go/types.go

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -859,28 +859,24 @@ type ProviderConfig struct {
859859
Azure *AzureProviderOptions `json:"azure,omitempty"`
860860
// Headers are custom HTTP headers included in outbound provider requests.
861861
Headers map[string]string `json:"headers,omitempty"`
862-
// ModelID is the well-known model ID used to look up agent configuration
863-
// (tools, prompts, reasoning behavior) and default token limits from the
864-
// capability catalog. Useful for fine-tuned models that should inherit the
865-
// configuration of a known base model.
866-
// Defaults to the session's configured model (SessionConfig.Model) when
867-
// not explicitly set.
862+
// ModelID is the well-known model name used by the runtime to look up
863+
// agent configuration (tools, prompts, reasoning behavior) and default
864+
// token limits. Also used as the wire model when WireModel is not set.
865+
// Falls back to SessionConfig.Model.
868866
ModelID string `json:"modelId,omitempty"`
869-
// WireModel is the model identifier sent to the provider API for inference.
870-
// Use this when the name your provider knows (e.g. an Azure deployment name
871-
// or a custom fine-tune name) differs from the well-known model ID used for
872-
// configuration lookup.
873-
// Defaults to the session's configured model (SessionConfig.Model) when
874-
// not explicitly set.
867+
// WireModel is the model name sent to the provider API for inference. Use
868+
// this when the provider's model name (e.g. an Azure deployment name or a
869+
// custom fine-tune name) differs from ModelID.
870+
// Falls back to ModelID, then SessionConfig.Model.
875871
WireModel string `json:"wireModel,omitempty"`
876-
// MaxPromptTokens is the maximum number of tokens allowed in the prompt for
877-
// a single LLM API request. Used by the runtime to trigger conversation
878-
// compaction before sending a request when the prompt (system message,
879-
// history, tool definitions, user message) exceeds this limit.
880-
MaxPromptTokens int `json:"maxPromptTokens,omitempty"`
881-
// MaxOutputTokens is the maximum number of tokens the model can generate in
882-
// a single response. When hit, the model stops generating and returns a
883-
// truncated response.
872+
// MaxInputTokens overrides the resolved model's default max prompt tokens.
873+
// The runtime triggers conversation compaction before sending a request
874+
// when the prompt (system message, history, tool definitions, user
875+
// message) would exceed this limit.
876+
MaxInputTokens int `json:"maxPromptTokens,omitempty"`
877+
// MaxOutputTokens overrides the resolved model's default max output
878+
// tokens. When hit, the model stops generating and returns a truncated
879+
// response.
884880
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
885881
}
886882

go/types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func TestProviderConfig_JSONIncludesAllFields(t *testing.T) {
159159
Headers: map[string]string{"Authorization": "Bearer provider-token"},
160160
ModelID: "gpt-4o",
161161
WireModel: "my-finetune-v3",
162-
MaxPromptTokens: 100000,
162+
MaxInputTokens: 100000,
163163
MaxOutputTokens: 4096,
164164
}
165165

nodejs/src/client.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import type {
4242
GetAuthStatusResponse,
4343
GetStatusResponse,
4444
ModelInfo,
45+
ProviderConfig,
4546
ResumeSessionConfig,
4647
SectionTransformFn,
4748
SessionConfig,
@@ -64,6 +65,17 @@ import type {
6465
} from "./types.js";
6566
import { defaultJoinSessionPermissionHandler } from "./types.js";
6667

68+
/**
69+
* Convert a {@link ProviderConfig} to its JSON-RPC wire shape, remapping
70+
* camelCase SDK property names to the wire keys expected by the runtime
71+
* (e.g. `maxInputTokens` → `maxPromptTokens`).
72+
*/
73+
function toWireProviderConfig(provider: ProviderConfig): Record<string, unknown> {
74+
const { maxInputTokens, ...rest } = provider;
75+
if (maxInputTokens === undefined) return rest;
76+
return { ...rest, maxPromptTokens: maxInputTokens };
77+
}
78+
6779
/**
6880
* Minimum protocol version this SDK can communicate with.
6981
* Servers reporting a version below this are rejected.
@@ -788,7 +800,7 @@ export class CopilotClient {
788800
systemMessage: wireSystemMessage,
789801
availableTools: config.availableTools,
790802
excludedTools: config.excludedTools,
791-
provider: config.provider,
803+
provider: config.provider ? toWireProviderConfig(config.provider) : undefined,
792804
modelCapabilities: config.modelCapabilities,
793805
requestPermission: true,
794806
requestUserInput: !!config.onUserInputRequest,
@@ -931,7 +943,7 @@ export class CopilotClient {
931943
name: cmd.name,
932944
description: cmd.description,
933945
})),
934-
provider: config.provider,
946+
provider: config.provider ? toWireProviderConfig(config.provider) : undefined,
935947
modelCapabilities: config.modelCapabilities,
936948
requestPermission:
937949
config.onPermissionRequest !== defaultJoinSessionPermissionHandler,

nodejs/src/types.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,35 +1505,32 @@ export interface ProviderConfig {
15051505
headers?: Record<string, string>;
15061506

15071507
/**
1508-
* Well-known model ID used to look up agent configuration (tools, prompts,
1509-
* reasoning behavior) and default token limits from the capability catalog.
1510-
* Useful for fine-tuned models that should inherit the configuration of a
1511-
* known base model.
1512-
* Defaults to the session's configured model (see {@link SessionConfig.model})
1513-
* when not explicitly set.
1508+
* Well-known model name used by the runtime to look up agent configuration
1509+
* (tools, prompts, reasoning behavior) and default token limits. Also used
1510+
* as the wire model when {@link wireModel} is not set.
1511+
* Falls back to {@link SessionConfig.model}.
15141512
*/
15151513
modelId?: string;
15161514

15171515
/**
1518-
* Model identifier sent to the provider API for inference.
1519-
* Use this when the name your provider knows (e.g. an Azure deployment name
1520-
* or a custom fine-tune name) differs from the well-known model ID used
1521-
* for configuration lookup.
1522-
* Defaults to the session's configured model (see {@link SessionConfig.model})
1523-
* when not explicitly set.
1516+
* Model name sent to the provider API for inference. Use this when the
1517+
* provider's model name (e.g. an Azure deployment name or a custom
1518+
* fine-tune name) differs from {@link modelId}.
1519+
* Falls back to {@link modelId}, then {@link SessionConfig.model}.
15241520
*/
15251521
wireModel?: string;
15261522

15271523
/**
1528-
* Maximum number of tokens allowed in the prompt for a single LLM API request.
1529-
* Used by the runtime to trigger conversation compaction before sending a request
1530-
* when the prompt (system message, history, tool definitions, user message) exceeds this limit.
1524+
* Overrides the resolved model's default max prompt tokens. The runtime
1525+
* triggers conversation compaction before sending a request when the
1526+
* prompt (system message, history, tool definitions, user message) would
1527+
* exceed this limit.
15311528
*/
1532-
maxPromptTokens?: number;
1529+
maxInputTokens?: number;
15331530

15341531
/**
1535-
* Maximum number of tokens the model can generate in a single response.
1536-
* When hit, the model stops generating and returns a truncated response.
1532+
* Overrides the resolved model's default max output tokens. When hit, the
1533+
* model stops generating and returns a truncated response.
15371534
*/
15381535
maxOutputTokens?: number;
15391536
}

nodejs/test/client.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ describe("CopilotClient", () => {
226226
headers: { Authorization: "Bearer provider-token" },
227227
modelId: "gpt-4o",
228228
wireModel: "my-finetune-v3",
229-
maxPromptTokens: 100_000,
229+
maxInputTokens: 100_000,
230230
maxOutputTokens: 4096,
231231
},
232232
});
@@ -265,7 +265,7 @@ describe("CopilotClient", () => {
265265
headers: { Authorization: "Bearer resume-token" },
266266
modelId: "gpt-4o",
267267
wireModel: "my-finetune-v3",
268-
maxPromptTokens: 100_000,
268+
maxInputTokens: 100_000,
269269
maxOutputTokens: 4096,
270270
},
271271
});

python/copilot/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2279,8 +2279,8 @@ def _convert_provider_to_wire_format(
22792279
wire_provider["modelId"] = provider["model_id"]
22802280
if "wire_model" in provider:
22812281
wire_provider["wireModel"] = provider["wire_model"]
2282-
if "max_prompt_tokens" in provider:
2283-
wire_provider["maxPromptTokens"] = provider["max_prompt_tokens"]
2282+
if "max_input_tokens" in provider:
2283+
wire_provider["maxPromptTokens"] = provider["max_input_tokens"]
22842284
if "max_output_tokens" in provider:
22852285
wire_provider["maxOutputTokens"] = provider["max_output_tokens"]
22862286
if "azure" in provider:

python/copilot/session.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -832,27 +832,23 @@ class ProviderConfig(TypedDict, total=False):
832832
bearer_token: str
833833
azure: AzureProviderOptions # Azure-specific options
834834
headers: dict[str, str]
835-
# Well-known model ID used to look up agent configuration (tools, prompts,
836-
# reasoning behavior) and default token limits from the capability catalog.
837-
# Useful for fine-tuned models that should inherit the configuration of a
838-
# known base model.
839-
# Defaults to the session's configured model (SessionConfig.model) when
840-
# not explicitly set.
835+
# Well-known model name used by the runtime to look up agent configuration
836+
# (tools, prompts, reasoning behavior) and default token limits. Also used
837+
# as the wire model when wire_model is not set.
838+
# Falls back to SessionConfig.model.
841839
model_id: str
842-
# Model identifier sent to the provider API for inference. Use this when the
843-
# name your provider knows (e.g. an Azure deployment name or a custom
844-
# fine-tune name) differs from the well-known model ID used for
845-
# configuration lookup.
846-
# Defaults to the session's configured model (SessionConfig.model) when
847-
# not explicitly set.
840+
# Model name sent to the provider API for inference. Use this when the
841+
# provider's model name (e.g. an Azure deployment name or a custom
842+
# fine-tune name) differs from model_id.
843+
# Falls back to model_id, then SessionConfig.model.
848844
wire_model: str
849-
# Maximum number of tokens allowed in the prompt for a single LLM API
850-
# request. Used by the runtime to trigger conversation compaction before
851-
# sending a request when the prompt (system message, history, tool
852-
# definitions, user message) exceeds this limit.
853-
max_prompt_tokens: int
854-
# Maximum number of tokens the model can generate in a single response.
855-
# When hit, the model stops generating and returns a truncated response.
845+
# Overrides the resolved model's default max prompt tokens. The runtime
846+
# triggers conversation compaction before sending a request when the prompt
847+
# (system message, history, tool definitions, user message) would exceed
848+
# this limit.
849+
max_input_tokens: int
850+
# Overrides the resolved model's default max output tokens. When hit, the
851+
# model stops generating and returns a truncated response.
856852
max_output_tokens: int
857853

858854

python/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ async def mock_request(method, params):
566566
"headers": {"Authorization": "Bearer provider-token"},
567567
"model_id": "gpt-4o",
568568
"wire_model": "my-finetune-v3",
569-
"max_prompt_tokens": 100_000,
569+
"max_input_tokens": 100_000,
570570
"max_output_tokens": 4096,
571571
},
572572
)
@@ -609,7 +609,7 @@ async def mock_request(method, params):
609609
"headers": {"Authorization": "Bearer resume-token"},
610610
"model_id": "gpt-4o",
611611
"wire_model": "my-finetune-v3",
612-
"max_prompt_tokens": 100_000,
612+
"max_input_tokens": 100_000,
613613
"max_output_tokens": 4096,
614614
},
615615
)

0 commit comments

Comments
 (0)