Fix query input #74

Open
Berack96 wants to merge 4 commits from fix-query-input into main
5 changed files with 31 additions and 7 deletions

View File

@@ -107,7 +107,12 @@ class Pipeline:
def condition_query_ok(step_input: StepInput) -> StepOutput:
val = step_input.previous_step_content
stop = (not val.is_crypto) if isinstance(val, QueryOutputs) else True
return StepOutput(stop=stop)
return StepOutput(stop=stop, content=step_input.input)
def sanitization_output(step_input: StepInput) -> StepOutput:
val = step_input.previous_step_content
content = f"Query: {step_input.input}\n\nRetrieved data: {self.remove_think(str(val))}"
return StepOutput(content=content)
copilot-pull-request-reviewer[bot] commented 2025-10-31 16:42:55 +01:00 (Migrated from github.com)
Review

The remove_think method is called as an instance method using self, but it's defined as a @classmethod. This will cause the method to receive the wrong first argument. Either change the call to cls.remove_think(str(val)) or remove the @classmethod decorator from the method definition.

            content = f"Query: {step_input.input}\n\nRetrieved data: {type(self).remove_think(str(val))}"
The `remove_think` method is called as an instance method using `self`, but it's defined as a `@classmethod`. This will cause the method to receive the wrong first argument. Either change the call to `cls.remove_think(str(val))` or remove the `@classmethod` decorator from the method definition. ```suggestion content = f"Query: {step_input.input}\n\nRetrieved data: {type(self).remove_think(str(val))}" ```
query_check = Step(name=PipelineEvent.QUERY_CHECK, agent=query_check)
info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team)
@@ -118,6 +123,7 @@ class Pipeline:
query_check,
condition_query_ok,
info_recovery,
sanitization_output,
report_generation
])
@@ -150,11 +156,22 @@ class Pipeline:
# Restituisce la risposta finale
if content and isinstance(content, str):
think_str = "</think>"
think = content.rfind(think_str)
yield content[(think + len(think_str)):] if think != -1 else content
yield cls.remove_think(content)
elif content and isinstance(content, QueryOutputs):
yield content.response
else:
logging.error(f"No output from workflow: {content}")
yield "Nessun output dal workflow, qualcosa è andato storto."
@classmethod
def remove_think(cls, text: str) -> str:
"""
Rimuove la sezione di pensiero dal testo.
Args:
text: Il testo da pulire.
Returns:
Il testo senza la sezione di pensiero.
"""
think_str = "</think>"
think = text.rfind(think_str)
return text[(think + len(think_str)):] if think != -1 else text

View File

@@ -13,3 +13,8 @@
- IS_CRYPTO: (empty)
- NOT_CRYPTO: "I can only analyze cryptocurrency topics."
- AMBIGUOUS: "Which cryptocurrency? (e.g., Bitcoin, Ethereum)"
**RULES:**
- DO NOT ANSWER the query.
- DO NOT PROVIDE ADDITIONAL INFORMATION.
- STOP instantly WHEN YOU CLASSIFY the query.

View File

@@ -8,7 +8,7 @@
- NEVER use placeholders ("N/A", "Data not available") - OMIT section instead
- NO example/placeholder data
**INPUT:** Structured report from Team Leader with optional sections:
**INPUT:** You will get the original user query and a structured report with optional sections:
- Overall Summary
- Market & Price Data (opt)
- News & Market Sentiment (opt)

View File

@@ -79,4 +79,6 @@ Timestamp: {{CURRENT_DATE}}
- Never modify MarketAgent prices
- Include all timestamps/sources
- Retry failed tasks (max 3)
- Only report agent data
- Only report agent data
- DO NOT fabricate or add info
- DO NOT add sources if none provided

View File

@@ -19,7 +19,7 @@ Historical: `{Asset, Period: {Start, End}, Data Points, Price Range: {Low, High}
**MANDATORY RULES:**
1. **Include timestamps** for every price data point
2. **Never fabricate** prices or dates - only report tool outputs
3. **Always specify the data source** (which API provided the data)
3. **Specify the data source** if provided, else state "source unavailable"
4. **Report data completeness**: If user asks for 30 days but got 7, state this explicitly
5. **Current date context**: Remind that data is as of {{CURRENT_DATE}}
6. **Token Optimization**: Be extremely concise to save tokens. Provide all necessary data using as few words as possible. Exceed 100 words ONLY if absolutely necessary to include all required data points.