MCPcopy Index your code
hub / github.com/TanStack/ai / mapOptionsToRequest

Method mapOptionsToRequest

packages/ai-grok/src/adapters/text.ts:69–97  ·  view source on GitHub ↗
(
    options: TextOptions<TProviderOptions>,
  )

Source from the content-addressed store, hash-verified

67 }
68
69 protected override mapOptionsToRequest(
70 options: TextOptions<TProviderOptions>,
71 ): Omit<ResponseCreateParams, 'stream'> {
72 const { tools: _baseTools, ...request } = super.mapOptionsToRequest({
73 ...options,
74 tools: undefined,
75 })
76 void _baseTools
77
78 if (this.model === 'grok-build-0.1' && request.reasoning !== undefined) {
79 throw new Error(
80 'grok-build-0.1 does not support reasoning modelOptions; omit reasoning for this model.',
81 )
82 }
83
84 const tools = options.tools
85 ? convertToolsToProviderFormat(options.tools)
86 : undefined
87
88 return {
89 ...request,
90 // xAI recommends encrypted reasoning for reasoning-capable Responses
91 // requests; callers can still override either field in modelOptions.
92 store: request.store ?? false,
93 include: request.include ?? ['reasoning.encrypted_content'],
94 ...(tools &&
95 tools.length > 0 && { tools: tools as ResponseCreateParams['tools'] }),
96 }
97 }
98}
99
100/**

Callers 6

chatStreamFunction · 0.45
structuredOutputFunction · 0.45
structuredOutputStreamFunction · 0.45
chatStreamFunction · 0.45
structuredOutputFunction · 0.45
structuredOutputStreamFunction · 0.45

Calls 1

Tested by

no test coverage detected