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

Model Configs #109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

williamjameshandley
Copy link
Contributor

This pull request refactors and extends the configuration and provider logic for the assistant. The main changes include:

• Moving type definitions: The AssistantConfig definition has been removed from assistant.py and redefined in config.py. Additionally, a new ModelConfig type is introduced in config.py to support model-specific configuration (API key, base URL, and pricing overrides).

• Updating provider selection logic: The get_completion_provider function now prioritizes the “oai-azure:” prefix and, for models that don’t match any specific prefix, defaults to the OpenAICompletionProvider instead of raising an error. This simplifies the model selection logic.

• Enhancing the Assistant class:  – The constructor and the from_config classmethod now accept an optional model_configs dictionary.  – In complete_chat, the code checks if a model configuration override exists for the requested model, and if so, it uses the override values for the API key, base URL, and pricing. Pricing information is later passed to the completion provider.

• Propagating model configuration: The init_assistant function and main entry point in gpt.py have been updated to pass the optional model_configs, ensuring that the new model-specific settings are used throughout.

• Adjusting OpenAICompletionProvider behavior: In the streaming completion process, pricing is now determined from the provided args (using an override if available) before emitting UsageEvent objects, ensuring that pricing overrides are consistently applied.

Overall, the changes streamline configuration management, allow model-specific overrides for API connection parameters and pricing, and simplify provider selection without breaking backward compatibility.

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.

1 participant