feat(minecraft): (does it work???)use native reasoning field instead of [REASONING] prefix hack
Replace manual reasoning prefix concatenation with proper reasoning field in Message type, enable reasoning with configurable effort (default: low) in LLM calls, extract reasoningText from response instead of reasoning property
This commit is contained in:
@@ -235,10 +235,13 @@ export class Brain {
|
||||
|
||||
// Only append to conversation history after successful parsing (avoid dirty data on retry)
|
||||
this.conversationHistory.push({ role: 'user', content: userMessage })
|
||||
const assistantContent = capturedReasoning
|
||||
? `[REASONING] ${capturedReasoning}\n\n${result}`
|
||||
: result
|
||||
this.conversationHistory.push({ role: 'assistant', content: assistantContent })
|
||||
// Store reasoning in the assistant message's reasoning field (if available)
|
||||
// Reasoning is transient thinking and doesn't need the [REASONING] prefix hack anymore
|
||||
this.conversationHistory.push({
|
||||
role: 'assistant',
|
||||
content: result,
|
||||
...(capturedReasoning && { reasoning: capturedReasoning }),
|
||||
} as Message)
|
||||
|
||||
if (action.tool === 'skip') {
|
||||
this.deps.logger.log('INFO', 'Brain: Skipping turn (observing)')
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface LLMConfig {
|
||||
export interface LLMCallOptions {
|
||||
messages: Message[]
|
||||
responseFormat?: { type: 'json_object' }
|
||||
reasoning?: { effort: 'low' | 'medium' | 'high' }
|
||||
}
|
||||
|
||||
export interface LLMResult {
|
||||
@@ -35,11 +36,13 @@ export class LLMAgent {
|
||||
model: this.config.model,
|
||||
messages: options.messages,
|
||||
...(options.responseFormat && { responseFormat: options.responseFormat }),
|
||||
})
|
||||
// Enable reasoning with configurable effort (default: low)
|
||||
reasoning: options.reasoning ?? { effort: 'low' },
|
||||
} as Parameters<typeof generateText>[0])
|
||||
|
||||
return {
|
||||
text: response.text ?? '',
|
||||
reasoning: (response as any).reasoning,
|
||||
reasoning: (response as any).reasoningText,
|
||||
usage: response.usage,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user