-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from dougollerenshaw/add_gemini
Add gemini to available models
- Loading branch information
Showing
9 changed files
with
158 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,7 @@ codeaide.spec | |
dist/ | ||
|
||
# Ignore .dmg files | ||
*.dmg | ||
*.dmg | ||
|
||
# Ignore .egg-info directories | ||
*.egg-info/ |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
This is a little sandbox script to test out the Gemini API. | ||
""" | ||
|
||
import argparse | ||
from decouple import config | ||
import google.generativeai as genai | ||
from codeaide.utils.constants import SYSTEM_PROMPT | ||
|
||
genai.configure(api_key=config("GEMINI_API_KEY")) | ||
|
||
model = genai.GenerativeModel("gemini-1.5-pro", system_instruction=SYSTEM_PROMPT) | ||
|
||
|
||
def generate_a_story(): | ||
response = model.generate_content("Write a story about a magic backpack.") | ||
print(response.text) | ||
|
||
|
||
def request_code(): | ||
response = model.generate_content( | ||
"Write a Python function to calculate the Fibonacci sequence." | ||
) | ||
print(response.text) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Gemini API prototype script") | ||
parser.add_argument( | ||
"action", | ||
choices=["story", "code"], | ||
help="Action to perform: generate a story or request code", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.action == "story": | ||
generate_a_story() | ||
elif args.action == "code": | ||
request_code() |
This file contains 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
Oops, something went wrong.