Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 20, 2025

This PR extends the AI chat system with two new optional parameters: verbosity and reasoning_effort, providing developers with fine-grained control over AI response characteristics.

New Parameters

verbosity

Controls the level of detail in AI responses:

  • low: Produces concise, brief responses
  • medium: Produces moderately detailed responses (default behavior)
  • high: Produces detailed, comprehensive responses

reasoning_effort

Controls the reasoning effort applied when generating responses:

  • minimal: Quick responses with minimal reasoning
  • low: Some reasoning applied to responses
  • medium: Moderate reasoning effort (balanced approach)
  • high: Extensive reasoning and analysis

Usage Examples

// Control response verbosity
const response = await ai.chat("Explain quantum computing", {
    verbosity: "high",  // Get detailed explanation
    preferredModel: "gpt-4"
});

// Control reasoning effort for complex problems
const analysis = await ai.chat("Analyze this business strategy", {
    reasoningEffort: "high",  // Apply thorough analysis
    maxCompletionTokens: 500
});

// Works with streaming too
const stream = await ai.stream.chat("Write a story", {
    verbosity: "low",        // Keep it concise
    reasoningEffort: "medium", // Balanced creativity
    temperature: 0.7
});

Implementation

  • OpenAI: reasoning_effort maps directly to the native parameter for compatible models (like o1), while verbosity is implemented via system message instructions
  • Google AI: Both parameters implemented through system message modification for consistent behavior
  • Anthropic: Both parameters implemented through system message modification for consistent behavior

Backward Compatibility

Both parameters are optional and maintain full backward compatibility. Existing code continues to work unchanged while new code can leverage the enhanced control options.

Testing

Added comprehensive unit tests covering both regular and streaming chat functionality, ensuring parameters are properly validated and passed through the entire system.

Extends #654 with additional functionality requested in PR feedback.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLAassistant commented Aug 20, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ KallynGowdy
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@Copilot Copilot AI changed the title [WIP] Add additional options to ai.chat and ai.stream.chat Add max_completion_tokens support to ai.chat and ai.stream.chat Aug 20, 2025
@Copilot Copilot AI requested a review from KallynGowdy August 20, 2025 19:50
Copilot finished work on behalf of KallynGowdy August 20, 2025 19:50
@Copilot Copilot AI requested a review from KallynGowdy August 21, 2025 13:52
Copilot finished work on behalf of KallynGowdy August 21, 2025 13:52
@KallynGowdy
Copy link
Member

@copilot Please also add the following options for ai.chat() and ai.stream.chat():

  • verbosity: Can be one of low, medium, or high
  • reasoning_effort: Can be one of minimal, low, medium, high

Copy link
Contributor Author

Copilot AI commented Aug 21, 2025

@copilot Please also add the following options for ai.chat() and ai.stream.chat():

  • verbosity: Can be one of low, medium, or high
    ...

Added the requested verbosity and reasoning_effort options to ai.chat() and ai.stream.chat():

  • verbosity: 'low' | 'medium' | 'high' - Controls response detail level through system message instructions
  • reasoning_effort: 'minimal' | 'low' | 'medium' | 'high' - Maps to OpenAI's native reasoning_effort parameter for compatible models

Both parameters are optional and work with all AI providers. The reasoning_effort parameter is passed directly to OpenAI (when supported), while verbosity is implemented via system message modification across all providers for consistent behavior.

Commit: 5226c76

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • binaries.prisma.sh
    • Triggering command: node /home/REDACTED/.local/share/pnpm/.tools/pnpm/10.10.0/bin/pnpm install --frozen-lockfile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title Add max_completion_tokens support to ai.chat and ai.stream.chat Add verbosity and reasoning_effort support to ai.chat and ai.stream.chat Aug 21, 2025
Copilot finished work on behalf of KallynGowdy August 21, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants