Skip to content

Conversation

@WahadMasriDev
Copy link
Collaborator

No description provided.

test_case_list.append(test_case)

# Use Gemini if GEMINI_API_KEY is available, otherwise fallback to OpenAI
use_gemini = os.getenv("GEMINI_API_KEY") and os.getenv("GEMINI_API_KEY") != ""
Copy link
Owner

Choose a reason for hiding this comment

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

why use gemini by default? this might break this code and existing runs that relies on openai API

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you do not put a Gemini key, by default the code will revert back to using Openai API by default this is a check done to use gemini when GEMINI_API_KEY is available as environment variable

call_demo*.py
demo*.py
__pycache__/*
__pycache__
Copy link
Owner

Choose a reason for hiding this comment

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

why removing /* here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is done to ignore pycache dirs completely not keep the folder there and just ignore whats inside

import concurrent.futures
import google.generativeai as genai
import os
import time
Copy link
Owner

Choose a reason for hiding this comment

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

why is this imported twice

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

time being imported twice is just a mistake

completions_code.append(completion)

# Use Gemini if GEMINI_API_KEY is available, otherwise fallback to OpenAI
use_gemini = os.getenv("GEMINI_API_KEY") and os.getenv("GEMINI_API_KEY") != ""
Copy link
Owner

Choose a reason for hiding this comment

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

repetitive code here, please abstract this into a function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I understand the repetitive nature of it but I feel like it is a bit more visual to keep it that way. But I will abstract into function

Comment on lines +1004 to +1005
client = openai.OpenAI()
completion = client.chat.completions.create(
Copy link
Owner

Choose a reason for hiding this comment

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

have you tested this openai usage? why is this change necessary? have you updated the README regarding installation?

# Return the first triple code snippet.
def response_2_code(response):
code_template = re.compile('```.*\n([\s\S]+?)\n```', re.M)
code_template = re.compile(r'```.*\n([\s\S]+?)\n```', re.M)
Copy link
Owner

Choose a reason for hiding this comment

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

what is this for

return -1
# Use Gemini if OpenAI keys are dummy/empty, otherwise use OpenAI
openai_key = os.environ.get('OPENAI_API_KEY', '')
use_gemini = openai_key == "dummy" or openai_key == ""
Copy link
Owner

Choose a reason for hiding this comment

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

same for this file. the code base is becoming very complicated with your gemini change. Please refactor this.

Copy link
Owner

Choose a reason for hiding this comment

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

please abstract our the use gemini or openai logic as mentioned, otherwise the codebase is much more complicated.

Copy link
Owner

Choose a reason for hiding this comment

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

this file has many previous runs. Please be very careful about any change in this class. You should not let gemini override openai. Please pass an argument for using gemini for your use case and this code should use openai by default for maintaining previous runs.

@jie-jw-wu
Copy link
Owner

please test this code and add screenshots of the results. Also add the commands you use to run the code in this PR and in README.

@jie-jw-wu
Copy link
Owner

please add PR description, currently it's empty

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.

3 participants