From 9378e4765b171788cab41b86a73c02d38be509be Mon Sep 17 00:00:00 2001 From: The Google Earth Engine Community Authors Date: Mon, 6 May 2024 14:13:59 -0700 Subject: [PATCH] Add a forgotten 'f' before a string that containts a varaible (round_num) Better image model prompt. PiperOrigin-RevId: 631181754 --- experimental/ee_agent.py | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/experimental/ee_agent.py b/experimental/ee_agent.py index e3e402dcc..1850d3ddf 100755 --- a/experimental/ee_agent.py +++ b/experimental/ee_agent.py @@ -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( @@ -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}, @@ -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