Upsonic / Server

Self-Driven Autonomous Python Libraries
https://docs.upsonic.co
MIT License
8 stars 1 forks source link

Sweep: Make a counter system to AI calls in upsonic_on_prem/utils/ai/ai.py #67

Open onuratakan opened 6 months ago

onuratakan commented 6 months ago

I want to track which models are using in what frequency. Make a counter and create debug log in every 10 call.

Checklist - [X] Modify `upsonic_on_prem/utils/ai/ai.py` ✓ https://github.com/Upsonic/On-Prem/commit/0ff6bccf7f6d63811f8f3f2cd008d7127713c17e [Edit](https://github.com/Upsonic/On-Prem/edit/sweep/make_a_counter_system_to_ai_calls_in_ups/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/make_a_counter_system_to_ai_calls_in_ups/upsonic_on_prem/utils/ai/ai.py)
onuratakan commented 6 months ago
Sweeping

50%
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: None)

[!TIP] I can email you when I complete this pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/Upsonic/On-Prem/blob/977a50d24d4eb91eaecffb023c8a544f4883e3c6/upsonic_on_prem/utils/ai/ai.py#L2-L363

Step 2: ⌨️ Coding


Step 3: 🔁 Code Review

Working on it...


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 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.

onuratakan commented 6 months ago

🚀 Here's the PR! #68

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: None)

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/Upsonic/On-Prem/blob/977a50d24d4eb91eaecffb023c8a544f4883e3c6/upsonic_on_prem/utils/ai/ai.py#L1-L363

Step 2: ⌨️ Coding

--- 
+++ 
@@ -123,6 +123,10 @@

     def completion(self, input_text, model):
         result = None
+        self.model_call_counter[model] = self.model_call_counter.get(model, 0) + 1
+        call_count = self.model_call_counter[model]
+        if call_count % 10 == 0:
+            debug(f"Model {model} has been called {call_count} times.")
         if model == "gemma-2b":
             result = self.gemmma(input_text)
         elif model == "gpt-3.5-turbo":
@@ -361,4 +365,6 @@

+    model_call_counter = {}
+
 AI = AI_()

Ran GitHub Actions for 0ff6bccf7f6d63811f8f3f2cd008d7127713c17e:


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/make_a_counter_system_to_ai_calls_in_ups.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 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.