Created
June 23, 2025 07:39
-
-
Save googlefan256/a9555445974ad1e368d56a44c22becde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ai(prompt: str): | |
from google import genai | |
client = genai.Client(api_key="") | |
response = client.models.generate_content( | |
model="gemini-2.5-flash-lite-preview-06-17", | |
contents=f"Write a python3 code only, no explanation. {prompt}" | |
) | |
code = response.text | |
if code.startswith("```python"): | |
code = code.removeprefix("```python").strip() | |
if code.endswith("```"): | |
code = code.removesuffix("```").strip() | |
exec(code, globals()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment