You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/spec/sampling.md
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Message content can be either text or images, allowing for multimodal interactio
37
37
38
38
### Model Preferences
39
39
40
-
Servers can express preferences for model selection using the `ModelPreferences` object. This allows servers to indicate priorities for factors like cost, speed, and intelligence, as well as provide name hints for specific models.
40
+
Servers can express preferences for model selection using the `ModelPreferences` object. This allows servers to indicate priorities for factors like cost, speed, and intelligence, as well as provide hints for specific models.
41
41
42
42
## Use Cases
43
43
@@ -61,7 +61,11 @@ A server requesting a chat response with model preferences:
61
61
"maxTokens": 100,
62
62
"temperature": 0.7,
63
63
"modelPreferences": {
64
-
"nameHints": ["claude-3-sonnet"],
64
+
"hints": [
65
+
{
66
+
"name": "claude-3-sonnet"
67
+
}
68
+
],
65
69
"intelligencePriority": 0.8,
66
70
"speedPriority": 0.5
67
71
}
@@ -93,7 +97,14 @@ A server requesting analysis of an image:
Copy file name to clipboardExpand all lines: schema/schema.json
+10-7Lines changed: 10 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -907,19 +907,19 @@
907
907
"minimum": 0,
908
908
"type": "number"
909
909
},
910
+
"hints": {
911
+
"description": "Optional string hints to use for model selection. How these hints are\ninterpreted depends on the key(s) in each record:\n\n- If the record contains a `name` key:\n - The client SHOULD treat this as a substring of a model name; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n - The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\n\nAll other keys are currently left unspecified by the spec and are up to the\nclient to interpret.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.",
912
+
"items": {
913
+
"$ref": "#/definitions/Record<string,string>"
914
+
},
915
+
"type": "array"
916
+
},
910
917
"intelligencePriority": {
911
918
"description": "How much to prioritize intelligence and capabilities when selecting a\nmodel. A value of 0 means intelligence is not important, while a value of 1\nmeans intelligence is the most important factor.",
912
919
"maximum": 1,
913
920
"minimum": 0,
914
921
"type": "number"
915
922
},
916
-
"nameHints": {
917
-
"description": "Optional string hints to use for model selection.\n\nThe client SHOULD treat these as substrings of model names; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n\nThe client MAY also map hints to a different provider's model or a\ndifferent model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these string hints over the numeric\npriorities, but MAY still use the priorities to select from ambiguous\nmatches.",
918
-
"items": {
919
-
"type": "string"
920
-
},
921
-
"type": "array"
922
-
},
923
923
"speedPriority": {
924
924
"description": "How much to prioritize sampling speed (latency) when selecting a model. A\nvalue of 0 means speed is not important, while a value of 1 means speed is\nthe most important factor.",
* faster but less capable, others are more capable but more expensive, and so
748
748
* on. This interface allows servers to express their priorities across multiple
749
749
* dimensions to help clients make an appropriate selection for their use case.
750
-
*
750
+
*
751
751
* These preferences are always advisory. The client MAY ignore them. It is also
752
752
* up to the client to decide how to interpret these preferences and how to
753
753
* balance them against other considerations.
754
754
*/
755
755
exportinterfaceModelPreferences{
756
756
/**
757
-
* Optional string hints to use for model selection.
757
+
* Optional string hints to use for model selection. How these hints are
758
+
* interpreted depends on the key(s) in each record:
758
759
*
759
-
* The client SHOULD treat these as substrings of model names; for example:
760
-
* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
761
-
* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
762
-
* - `claude` should match any Claude model
760
+
* - If the record contains a `name` key:
761
+
* - The client SHOULD treat this as a substring of a model name; for example:
762
+
* - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`
763
+
* - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.
764
+
* - `claude` should match any Claude model
765
+
* - The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:
766
+
* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
763
767
*
764
-
* The client MAY also map hints to a different provider's model or a
765
-
* different model family, as long as it fills a similar niche; for example:
766
-
* - `gemini-1.5-flash` could match `claude-3-haiku-20240307`
768
+
* All other keys are currently left unspecified by the spec and are up to the
769
+
* client to interpret.
767
770
*
768
771
* If multiple hints are specified, the client MUST evaluate them in order
769
772
* (such that the first match is taken).
770
773
*
771
-
* The client SHOULD prioritize these string hints over the numeric
772
-
* priorities, but MAY still use the priorities to select from ambiguous
773
-
* matches.
774
+
* The client SHOULD prioritize these hints over the numeric priorities, but
775
+
* MAY still use the priorities to select from ambiguous matches.
774
776
*/
775
-
nameHints?: string[];
777
+
hints?: Record<"name"|string,string>[];
776
778
777
779
/**
778
780
* How much to prioritize cost when selecting a model. A value of 0 means cost
0 commit comments