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

OpenAI Provider Refactoring #16

Merged
merged 3 commits into from
Dec 16, 2024
Merged

Conversation

shahariaazam
Copy link
Member

This pull request includes significant changes to the OpenAI LLM provider implementation and its tests. The main changes involve refactoring the client structure, adding example usage comments, and updating the tests to use a mock client.

Refactoring and improvements:

  • ai/llm_provider_openai.go: Refactored the OpenAILLMProvider structure to use an OpenAIClient interface instead of the openai.Client type directly, and added example usage comments for better clarity. [1] [2] [3]

Testing enhancements:

  • ai/llm_provider_openai_test.go: Introduced a MockOpenAIClient to facilitate testing, and updated the tests to use this mock client. This includes creating mock streaming responses for testing streaming functionality. [1] [2] [3] [4]

…ection

- Extract OpenAIClient interface for better testability
- Update provider to accept client through constructor
- Refactor tests to use mock client implementation
- Improve documentation with usage examples
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@shahariaazam shahariaazam merged commit b875a6d into master Dec 16, 2024
4 of 5 checks passed
@shahariaazam shahariaazam deleted the refactoring-openai-client branch December 16, 2024 23:23
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