Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code execution #457

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions samples/code_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def test_code_execution_basic(self):
"Generate and run code for the calculation, and make sure you get all 50."
)
)

# Each `part` either contains `text`, `executable_code` or an `execution_result`
for part in result.candidates[0].content.parts:
print(part, '\n')
print(part, "\n")

print('-'*80)
# The `.text` accessor joins the parts into a markdown compatible text representation.
print('\n\n', response.text)
print("-" * 80)
# The `.text` accessor joins the parts into a markdown compatible text representation.
print("\n\n", response.text)
# [END code_execution_basic]

# [START code_execution_basic_return]
Expand All @@ -54,7 +54,7 @@ def test_code_execution_basic(self):
#
#
# --------------------------------------------------------------------------------
# I can help with that! To calculate the sum of the first 50 prime numbers, we'll need to first identify all the prime numbers up to the 50th prime number.
# I can help with that! To calculate the sum of the first 50 prime numbers, we'll need to first identify all the prime numbers up to the 50th prime number.
#
# Here is the code to find and sum the first 50 prime numbers:
#
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_code_execution_basic(self):
# The sum of the first 50 prime numbers is: 5117
#
# ```
# I ran the code and it calculated that the sum of the first 50 prime numbers is 5117.
# I ran the code and it calculated that the sum of the first 50 prime numbers is 5117.
# [END code_execution_basic_return]

def test_code_execution_request_override(self):
Expand Down
Loading