Open onuratakan opened 8 months ago
None
)[!TIP] I can email you next time I complete a pull request if you set up your email here!
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
upsonic_on_prem/utils/ai/ai.py
✓ https://github.com/Upsonic/On-Prem/commit/80d2fda59906c473dcf52e06587a74d1b4439172 Edit
Modify upsonic_on_prem/utils/ai/ai.py with contents:
• Add a new method named `chat` in the `AI_` class within the `ai.py` file. This method should closely resemble the structure of the `completion` method but be specifically designed for chat interactions.
• The `chat` method should accept two parameters: `input_text` (the user's input text for the chat) and `model` (the model to use for generating the chat response, with a default value of "gpt-3.5-turbo").
• Inside the `chat` method, use the `gpt` method to send the `input_text` to the specified model and return the response. This leverages the existing infrastructure for interacting with AI models and ensures consistency in how models are utilized across the module.
• Example method signature: `def chat(self, input_text, model="gpt-3.5-turbo"):`
• Inside the `chat` method, construct the request to the model in a manner that is suitable for chat interactions. This may involve setting up the `input_text` as part of a conversation context if the model supports such a format.
• Return the response from the model directly or format it as needed before returning to the caller.
• Ensure that the method includes error handling, similar to other methods in the `AI_` class, to gracefully manage any issues that arise during the interaction with the model.
--- +++ @@ -395,4 +395,11 @@ return result + def chat(self, input_text, model="gpt-3.5-turbo"): + try: + return self.gpt(input_text, model=model) + except Exception as e: + failed(f"Failed to generate chat response: {e}") + return None + AI = AI_()
upsonic_on_prem/utils/ai/ai.py
✓ Edit
Check upsonic_on_prem/utils/ai/ai.py with contents:
Ran GitHub Actions for 80d2fda59906c473dcf52e06587a74d1b4439172:
I have finished reviewing the code for completeness. I did not find errors for sweep/create_a_chat_function_like_completion_i
.
💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.
This is an automated message generated by Sweep AI.
Checklist
- [X] Modify `upsonic_on_prem/utils/ai/ai.py` ✓ https://github.com/Upsonic/On-Prem/commit/80d2fda59906c473dcf52e06587a74d1b4439172 [Edit](https://github.com/Upsonic/On-Prem/edit/sweep/create_a_chat_function_like_completion_i/upsonic_on_prem/utils/ai/ai.py) - [X] Running GitHub Actions for `upsonic_on_prem/utils/ai/ai.py` ✓ [Edit](https://github.com/Upsonic/On-Prem/edit/sweep/create_a_chat_function_like_completion_i/upsonic_on_prem/utils/ai/ai.py)