Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: respect character config model settings #845

Closed

Conversation

seanbhart
Copy link

Relates to:

N/A - Improvement to model selection functionality

Risks

Low - Changes only affect how model class is selected, with fallback to default values

Background

What does this PR do?

Updates model class selection to respect character configuration settings instead of using hardcoded values. This allows characters to use different model sizes without code changes.

What kind of change is this?

Bug fix (allows existing config file settings to be implemented as indicated in the documentation)

Documentation changes needed?

Changes to code line references and a README note for Apple Silicon users

Testing

Where should a reviewer start?

Files changed:

  1. packages/client-direct/src/index.ts - Updated model selection in direct message handling
  2. packages/client-discord/src/messages.ts - Updated model selection in Discord message handling
  3. packages/client-telegram/src/index.ts - Updated model selection in Telegram message handling
  4. packages/client-farcaster/src/interactions.ts - Updated model selection in Farcaster interaction handling
  5. packages/plugin-bootstrap/src/actions/continue.ts - Updated model selection in continue action

The key change in each file is replacing hardcoded ModelClass.SMALL with:

modelClass: runtime.character.settings?.model || ModelClass.SMALL,

This ensures consistent model selection across all client types while maintaining the small model as a fallback.

Detailed testing steps

  1. Create a character config with model setting:
{
    "settings": {
        "model": "medium",
        "temperature": 0.45
    }
}
  1. Start agent with character config:
pnpm start --character="path/to/character.json"
  1. Verify in logs that responses use the configured model:
Generating text with options: 
{"modelProvider":"openai","model":"medium"}

Selected model: 
gpt-4o
  1. Test with different model settings ("small", "medium", "large") to verify proper model selection

Files changed:

  • packages/client-direct/src/index.ts
    • Updated generateMessageResponse() to use character model settings in direct message handling
  • packages/client-discord/src/messages.ts
    • Updated generateMessageResponse() to use character model settings in Discord message handling
  • packages/client-telegram/src/index.ts and packages/client-telegram/src/messageManager.ts
    • Updated generateMessageResponse() to use character model settings in Telegram message handling
  • packages/client-farcaster/src/interactions.ts
    • Updated generateMessageResponse() to use character model settings in Farcaster interaction handling
  • packages/plugin-bootstrap/src/actions/continue.ts
    • Modified model selection in CONTINUE action to use character settings
    • Updated both generateMessageResponse() and generateTrueOrFalse() calls

Deploy Notes

Standard build process:

pnpm build

No database changes or special deployment instructions needed.

Discord username

@seanbhart

@lalalune
Copy link
Member

lalalune commented Dec 5, 2024

Actually, these probably should be hardcoded... but not to SMALL. I made a PR here: #853 which should solve the same issue

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.

2 participants