MCPcopy Index your code
hub / github.com/docker/docker-agent / samplingModelOptions

Function samplingModelOptions

pkg/runtime/sampling.go:216–225  ·  view source on GitHub ↗

samplingModelOptions translates the server's advisory preferences into the host's model options. Only MaxTokens is honoured today (with an upper bound enforced by the underlying provider); temperature, stop sequences, and ModelPreferences are intentionally left to the host's configuration. Structure

(req *mcp.CreateMessageParams)

Source from the content-addressed store, hash-verified

214// reshape the model's reply into something the MCP server didn't ask
215// for.
216func samplingModelOptions(req *mcp.CreateMessageParams) []options.Opt {
217 opts := []options.Opt{
218 options.WithStructuredOutput(nil),
219 options.WithNoThinking(),
220 }
221 if req.MaxTokens > 0 {
222 opts = append(opts, options.WithMaxTokens(req.MaxTokens))
223 }
224 return opts
225}
226
227// drainSamplingStream reads a chat completion stream to completion and
228// returns the concatenated assistant content alongside the final finish

Callers 1

samplingHandlerMethod · 0.85

Calls 3

WithStructuredOutputFunction · 0.92
WithNoThinkingFunction · 0.92
WithMaxTokensFunction · 0.92

Tested by

no test coverage detected