Skip to content

Commit f993631

Browse files
committed
Add token limit and model override fields to ProviderConfig
Adds the following optional fields to ProviderConfig across all SDKs: - modelId: well-known model ID for agent config + token limit lookup - wireModel: model name sent to the provider API for inference - maxPromptTokens: prompt token cap (triggers compaction) - maxOutputTokens: response token cap Both modelId and wireModel default to the session's configured model when unset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6a0e065 commit f993631

5 files changed

Lines changed: 123 additions & 0 deletions

File tree

dotnet/src/Types.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,43 @@ public class ProviderConfig
15281528
/// </summary>
15291529
[JsonPropertyName("headers")]
15301530
public IDictionary<string, string>? Headers { get; set; }
1531+
1532+
/// <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.
1539+
/// </summary>
1540+
[JsonPropertyName("modelId")]
1541+
public string? ModelId { get; set; }
1542+
1543+
/// <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.
1550+
/// </summary>
1551+
[JsonPropertyName("wireModel")]
1552+
public string? WireModel { get; set; }
1553+
1554+
/// <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.
1558+
/// </summary>
1559+
[JsonPropertyName("maxPromptTokens")]
1560+
public int? MaxPromptTokens { get; set; }
1561+
1562+
/// <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.
1565+
/// </summary>
1566+
[JsonPropertyName("maxOutputTokens")]
1567+
public int? MaxOutputTokens { get; set; }
15311568
}
15321569

15331570
/// <summary>

go/types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,29 @@ 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.
868+
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.
875+
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.
884+
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
862885
}
863886

864887
// AzureProviderOptions contains Azure-specific provider configuration

nodejs/src/types.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,39 @@ export interface ProviderConfig {
15031503
* Custom HTTP headers to include in outbound provider requests.
15041504
*/
15051505
headers?: Record<string, string>;
1506+
1507+
/**
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.
1514+
*/
1515+
modelId?: string;
1516+
1517+
/**
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.
1524+
*/
1525+
wireModel?: string;
1526+
1527+
/**
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.
1531+
*/
1532+
maxPromptTokens?: number;
1533+
1534+
/**
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.
1537+
*/
1538+
maxOutputTokens?: number;
15061539
}
15071540

15081541
/**

python/copilot/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,14 @@ def _convert_provider_to_wire_format(
22752275
wire_provider["bearerToken"] = provider["bearer_token"]
22762276
if "headers" in provider:
22772277
wire_provider["headers"] = provider["headers"]
2278+
if "model_id" in provider:
2279+
wire_provider["modelId"] = provider["model_id"]
2280+
if "wire_model" in provider:
2281+
wire_provider["wireModel"] = provider["wire_model"]
2282+
if "max_prompt_tokens" in provider:
2283+
wire_provider["maxPromptTokens"] = provider["max_prompt_tokens"]
2284+
if "max_output_tokens" in provider:
2285+
wire_provider["maxOutputTokens"] = provider["max_output_tokens"]
22782286
if "azure" in provider:
22792287
azure = provider["azure"]
22802288
wire_azure: dict[str, Any] = {}

python/copilot/session.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,28 @@ 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.
841+
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.
848+
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.
856+
max_output_tokens: int
835857

836858

837859
class SessionConfig(TypedDict, total=False):

0 commit comments

Comments
 (0)