Skip to content

Conversation

@Junyi-99
Copy link
Member

This pull request introduces a significant refactor to how language models are referenced and handled across the codebase, moving from a legacy enum-based approach to a more flexible string-based "model slug" system. It also upgrades the OpenAI client library to v3 and updates configuration to use a new inference service. Additionally, several new models are now supported, and the handling of conversation history has been modernized for better compatibility and extensibility.

Key changes include:

Model Handling and API Changes:

  • Replaced the use of the deprecated LanguageModel enum throughout the API with a new modelSlug string field, updating all relevant function signatures and data structures to use the new approach. This includes fallback logic for backward compatibility. (internal/api/chat/create_conversation_message_stream.go, internal/api/chat/create_conversation_message_stream_helper.go, internal/models/conversation.go, internal/api/mapper/conversation.go) [1] F51da0ccL99, F51da0ccL165, F51da0ccL208, F51da0ccL236, [2] [3]

  • Upgraded the OpenAI client from v2 to v3 and refactored all usages and data types accordingly, including the way chat history is stored and sent. (go.mod, internal/api/chat/create_conversation_message_stream_helper.go, internal/models/conversation.go, internal/api/chat/list_supported_models.go) [1] [2] [3] F51da0ccL53, F51da0ccL70, F51da0ccL114, F51da0ccL154, [4] [5] [6] [7]

Supported Models Expansion:

  • Added support for new models including GPT-5 nano and Qwen variants, and updated the model slug formatting to use provider-prefixed slugs (e.g., openai/gpt-4o). (internal/api/chat/list_supported_models.go)

Configuration Refactor:

  • Changed configuration from OpenAI-specific fields (OpenAIBaseURL, OpenAIAPIKey) to more generic inference service fields (PDInferenceBaseURL, PDInferenceAPIKey) throughout the codebase and tests. (internal/libs/cfg/cfg.go, internal/libs/cfg/cfg_test.go) [1] F5f06866L19, F5f06866L29, [2]

Codebase Cleanup:

  • Removed the deprecated CreateConversationMessage method and its supporting code, consolidating all conversation message creation through the streaming API. (internal/api/chat/create_conversation_message_stream_helper.go)

These changes modernize the model selection process, improve extensibility for future models and providers, and align the codebase with the latest OpenAI client and internal infrastructure.

Copilot AI review requested due to automatic review settings December 15, 2025 16:00
ProjectID: projectID,
Title: DefaultConversationTitle,
LanguageModel: languageModel,
ModelSlug: modelSlug,
Copy link
Member Author

Choose a reason for hiding this comment

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

compatible

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 encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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