giving user an option to pass in the prompt
This commit is contained in:
9
main.py
9
main.py
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from dotenv import load_dotenv
|
||||
from google import genai
|
||||
|
||||
@@ -8,11 +9,15 @@ api_key = os.environ.get("GEMINI_API_KEY")
|
||||
client = genai.Client(api_key=api_key)
|
||||
|
||||
def main():
|
||||
print("Hello from boot-dev-ai-agent!")
|
||||
if len(sys.argv) < 2:
|
||||
print("Error: No prompt provided.\nUsage: uv run main.py \"<your prompt here>\"")
|
||||
sys.exit(1)
|
||||
|
||||
user_prompt = sys.argv[1]
|
||||
|
||||
response = client.models.generate_content(
|
||||
model="gemini-2.0-flash-001",
|
||||
contents="Why is Boot.dev such a great place to learn backend development? Use one paragraph maximum."
|
||||
contents=user_prompt
|
||||
)
|
||||
|
||||
print(response.text)
|
||||
|
||||
Reference in New Issue
Block a user