Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

reasoning-request.test.ts

39 lines1.3 KB

1import { describe, expect, it } from 'vitest'
2import { resolveDebugOption } from '@tanstack/ai/adapter-internals'
3import { GroqTextAdapter } from '../src/adapters/text'
4import type { ReasoningRequest } from '@tanstack/ai'
5import type { GROQ_CHAT_MODELS } from '../src/model-meta'
6​
7const logger = resolveDebugOption(false)
8​
9class Probe<
10 TModel extends (typeof GROQ_CHAT_MODELS)[number],
11> extends GroqTextAdapter<TModel> {
12 request(reasoning: ReasoningRequest) {
13 return this.mapOptionsToRequest({
14 model: this.model,
15 logger,
16 messages: [{ role: 'user', content: 'hi' }],
17 reasoning,
18 })
19 }
21​
22describe('Groq chat({ reasoning }) request shape', () => {
23 it('gpt-oss: reasoning_effort from the level', () => {
24 const adapter = new Probe({ apiKey: 'k' }, 'openai/gpt-oss-120b')
25 expect(adapter.request({ level: 'medium', summary: true })).toMatchObject({
26 reasoning_effort: 'medium',
27 })
28 })
29​
30 it('Qwen 3: default to think, none for off', () => {
31 const adapter = new Probe({ apiKey: 'k' }, 'qwen/qwen3-32b')
32 expect(adapter.request({ level: 'high', summary: true })).toMatchObject({
33 reasoning_effort: 'default',
34 })
35 expect(adapter.request({ level: 'off', summary: true })).toMatchObject({
36 reasoning_effort: 'none',
37 })
38 })
39})