File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 3131import textgen_with_txt_stream
3232import textgen_with_video
3333import textgen_with_youtube_video
34+ import txt_gen
3435
3536
3637os .environ ["GOOGLE_GENAI_USE_VERTEXAI" ] = "True"
3738os .environ ["GOOGLE_CLOUD_LOCATION" ] = "us-central1"
3839# The project name is included in the CICD pipeline
3940# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
4041
42+ def test_txt_gen () -> None :
43+ response = txt_gen .generate_content ()
44+ assert response
4145
4246def test_textgen_with_txt_stream () -> None :
4347 response = textgen_with_txt_stream .generate_content ()
Original file line number Diff line number Diff line change 1- from google import genai
21
3- client = genai .Client (http_options = {'api_version' : 'v1' })
4- response = client .models .generate_content (
5- model = "gemini-2.0-flash-001" ,
6- contents = "How does AI work?"
7- )
8- print (response .text )
9- # Example response:
10- # Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
11- #
12- # Here's a simplified overview:
13- # ...
2+ def generate_content ():
3+ from google import genai
4+
5+ client = genai .Client (http_options = {'api_version' : 'v1' })
6+ response = client .models .generate_content (
7+ model = "gemini-2.0-flash-001" ,
8+ contents = "How does AI work?"
9+ )
10+ return response .text
11+ # Example response:
12+ # Okay, let's break down how AI works. It's a broad field, so I'll focus on the ...
13+ #
14+ # Here's a simplified overview:
15+ # ...
You can’t perform that action at this time.
0 commit comments