Prompt example extracted from Google Gemini Cookbook.
Indentation
* **Use 4 spaces per indentation level.** (PEP 8 recommendation)
* When a function has multiple parameters, expend it on multiple lines with proper indentation for better readability:
```python
interaction = client.interactions.create(
model=MODEL_ID,
input="Here's my prompt",
config={
"response_mime_type": "application/json",
"response_schema": Schema
}
)
```
Notice the line break on the first and last lines.
* Long text variables should use triple double quotes and proper indentation for better readability:
```python
long_prompt = """
Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin.
Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake.
Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake.
Lemon drops tootsie roll marshmallow halvah carrot cake.
"""
```
Notice the line break on the first and last lines.
* When a multiline string is used inside a function call, add an extra indent level between the `"""` delimiters and the text body to visually separate the string content from the surrounding code:
```python
interaction = client.interactions.create(
model=MODEL_ID,
input=[
audio_file,
"""
Analyze this audio file and extract any musical chord
information. Return a JSON object with:
- "title": the song title if identifiable
- "key": the musical key
- "chords": a list of chord objects
""",
],
)
```