-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Description
To improve the testability of the basic_query
function in the ChatGPT
module, we need to refactor it to accept a ChatGPTClient
object. This will enable the use of a mock client during testing, while the actual client will be used during normal usage.
Tasks
-
Create a
MockChatGPTClient
struct that implements theChatGPTClient
trait. The mock client should return pre-defined responses for testing purposes instead of making actual API calls. -
Update the
basic_query
function signature to accept aChatGPTClient
object as a parameter. -
Update the test module to use the
MockChatGPTClient
for testing thebasic_query
function. -
Update the
main.rs
file to pass the default client when calling thebasic_query
function.
Acceptance Criteria
- The
basic_query
function accepts aChatGPTClient
object as a parameter. - A
MockChatGPTClient
struct is implemented for testing purposes. - A test for
basic_query
function is added that uses theMockChatGPTClient
. - The
main.rs
file is updated to pass the default client when callingbasic_query
.
Metadata
Metadata
Assignees
Labels
No labels