Skip to content

Commit

Permalink
Add a forgotten 'f' before a string that containts a varaible (round_…
Browse files Browse the repository at this point in the history
…num)

Better image model prompt.

PiperOrigin-RevId: 630248416
  • Loading branch information
The Google Earth Engine Community Authors authored and copybara-github committed May 6, 2024
1 parent 7baab22 commit 130dea4
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions experimental/ee_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ def chat(self, question: str, temperature: Optional[float] = None) -> str:
response = ''
try:
response = self._chat_proxy.send_message(
brief + question,
generation_config={
'temperature': temperature,
# Use a generous but limited output size to encourage in-depth
# replies.
'max_output_tokens': 5000,
}
brief + question,
generation_config={
'temperature': temperature,
# Use a generous but limited output size to encourage in-depth
# replies.
'max_output_tokens': 5000,
}
)
if not response.parts:
raise ValueError(
Expand Down Expand Up @@ -205,13 +205,22 @@ def analyze_image(self, url: str) -> str:
'parts': [
{
'text': """
'You are an expert visual analyst who never hallucinates
things you don't actually see. Describe what you see in
the image in as much detail as possible. However, avoid
guessing - if you see vague pixelated shapes, describe
what they look like geometrically rather than jumping to
conclusions about what they might represent. Analyze the
image content, colors, patterns, and features.
You are an objective, precise overhead imagery analyst. Describe what the
provided map tile depicts in terms of:
1. The colors, textures, and patterns visible in the image.
2. The spatial distribution, shape, and extent of distinct features or regions.
3. Any notable contrasts, boundaries, or gradients between different areas.
Avoid making assumptions about the specific geographic location, time period,
or cause of the observed features. Focus solely on the literal contents of the
image itself.
If the image is ambiguous or unclear, state so directly. Do not speculate or
hypothesize beyond what is directly visible.
Use clear, concise language. Avoid subjective interpretations or analogies.
Organize your response into structured paragraphs.
"""
},
{'inline_data': image},
Expand Down Expand Up @@ -409,7 +418,7 @@ def run_agent(
codes.append(code)
evals.append(evaluation)
recommendation_question = (
"""Given the history of previous attempts, what would you recommend to
f"""Given the history of previous attempts, what would you recommend to
do differently in the future code to answer the given request? Do
not comment on cosmetic things like code style; concentrate on
substantive suggestions. Output your recommendation in a form that
Expand Down

0 comments on commit 130dea4

Please sign in to comment.