Skip to content

Conversation

@kalvinnchau
Copy link
Contributor

add model specific configuration

This PR adds model specific configuration and updates the goose-cli and goose-server crates to use the updated Provider configuration and handle new configuration

changes

  • Introduce a new ModelConfig struct that is composed into each Provider specific config
    • add support for configuring context_limit + estimate_factor , temperature and max_tokens
    • context_limit has some defaults for known models set during ModelConfig::new() construction time.
      • order of preference: an explicitly set limit > default known model limit > DEFAULT_CONTEXT_LIMIT (128_000)
  • Refactored provider configurations to embed the ModelConfig struct and updated relevant uses of the model configuration
  • Update goose-cli and goose-server to use ModelConfig when constructing Providers
  • Update goose-cli and goose-server to handle the new config parameters following the current approach in each respective crate

config

Add in a new ModelConfig struct, as well as a trait ProviderModelConfig
which should be implemented on each Provider to propgate up model
specific configuration when used by the main agent.rs loop.

ModelConfig adds the context_limit variable and moves the name, temperature
and max_tokens configuration within it.

context_limit is set by the following order of precedence, and set at
construction time
1. explicit context_limit
2. defaults by model name (see get_model_specific_limit)
3. a global default set to 200_000

Remove the global ESTIMATE_FACTOR, and make it configurable per model

Add configuration via goose-cli profiles, verify goose-server
environment variable based configuration
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 17 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • crates/goose-cli/src/commands/configure.rs: Evaluated as low risk
  • crates/goose-cli/src/commands/session.rs: Evaluated as low risk
  • crates/goose-cli/src/profile.rs: Evaluated as low risk
  • crates/goose-cli/src/test_helpers.rs: Evaluated as low risk
  • crates/goose-server/src/configuration.rs: Evaluated as low risk
  • crates/goose-server/src/routes/reply.rs: Evaluated as low risk
  • crates/goose-server/src/state.rs: Evaluated as low risk
  • crates/goose/examples/image_tool.rs: Evaluated as low risk
  • crates/goose/src/agent.rs: Evaluated as low risk
  • crates/goose/src/providers/anthropic.rs: Evaluated as low risk
  • crates/goose/src/providers/base.rs: Evaluated as low risk
  • crates/goose/src/providers/configs.rs: Evaluated as low risk
Comments suppressed due to low confidence (1)

crates/goose/src/providers/mock.rs:22

  • [nitpick] The parameter name model_config is ambiguous. It should be renamed to config to be consistent with the rest of the codebase.
model_config: ModelConfig::new("mock-model".to_string()),

Copy link
Collaborator

@zakiali zakiali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

There is some overlap with this PR . We should merge the two implementations

@kalvinnchau kalvinnchau force-pushed the kalvin/model-context-limits branch 2 times, most recently from cd1067f to b2de530 Compare December 16, 2024 22:59
@kalvinnchau kalvinnchau merged commit de9b3df into v1.0 Dec 17, 2024
3 checks passed
jsibbison-square added a commit that referenced this pull request Dec 17, 2024
* v1.0:
  Newline in cli (#485)
  remove cliclack prompt (#484)
  feat:model-specific-configuration (#466)
lifeizhou-ap added a commit that referenced this pull request Dec 17, 2024
* v1.0:
  Restore command history when resuming session (#483)
  Newline in cli (#485)
  remove cliclack prompt (#484)
  feat:model-specific-configuration (#466)
  Adds session cost to goose.log (#474)
michaelneale added a commit that referenced this pull request Dec 18, 2024
* v1.0:
  feat: add google provider (#489)
  feat: flappy goose easter egg (#479)
  Restore command history when resuming session (#483)
  Newline in cli (#485)
  remove cliclack prompt (#484)
  feat:model-specific-configuration (#466)
@kalvinnchau kalvinnchau deleted the kalvin/model-context-limits branch December 20, 2024 16:45
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