Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dce8b45d7f | |||
| cf41c800bb | |||
| 2d1837ca4a | |||
| ba8406367c |
@@ -107,7 +107,12 @@ class Pipeline:
|
|||||||
def condition_query_ok(step_input: StepInput) -> StepOutput:
|
def condition_query_ok(step_input: StepInput) -> StepOutput:
|
||||||
val = step_input.previous_step_content
|
val = step_input.previous_step_content
|
||||||
stop = (not val.is_crypto) if isinstance(val, QueryOutputs) else True
|
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)
|
||||||
|
|
||||||
query_check = Step(name=PipelineEvent.QUERY_CHECK, agent=query_check)
|
query_check = Step(name=PipelineEvent.QUERY_CHECK, agent=query_check)
|
||||||
info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team)
|
info_recovery = Step(name=PipelineEvent.INFO_RECOVERY, team=team)
|
||||||
@@ -118,6 +123,7 @@ class Pipeline:
|
|||||||
query_check,
|
query_check,
|
||||||
condition_query_ok,
|
condition_query_ok,
|
||||||
info_recovery,
|
info_recovery,
|
||||||
|
sanitization_output,
|
||||||
report_generation
|
report_generation
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -150,11 +156,22 @@ class Pipeline:
|
|||||||
|
|
||||||
# Restituisce la risposta finale
|
# Restituisce la risposta finale
|
||||||
if content and isinstance(content, str):
|
if content and isinstance(content, str):
|
||||||
think_str = "</think>"
|
yield cls.remove_think(content)
|
||||||
think = content.rfind(think_str)
|
|
||||||
yield content[(think + len(think_str)):] if think != -1 else content
|
|
||||||
elif content and isinstance(content, QueryOutputs):
|
elif content and isinstance(content, QueryOutputs):
|
||||||
yield content.response
|
yield content.response
|
||||||
else:
|
else:
|
||||||
logging.error(f"No output from workflow: {content}")
|
logging.error(f"No output from workflow: {content}")
|
||||||
yield "Nessun output dal workflow, qualcosa è andato storto."
|
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
|
||||||
|
|||||||
@@ -13,3 +13,8 @@
|
|||||||
- IS_CRYPTO: (empty)
|
- IS_CRYPTO: (empty)
|
||||||
- NOT_CRYPTO: "I can only analyze cryptocurrency topics."
|
- NOT_CRYPTO: "I can only analyze cryptocurrency topics."
|
||||||
- AMBIGUOUS: "Which cryptocurrency? (e.g., Bitcoin, Ethereum)"
|
- 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.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
- NEVER use placeholders ("N/A", "Data not available") - OMIT section instead
|
- NEVER use placeholders ("N/A", "Data not available") - OMIT section instead
|
||||||
- NO example/placeholder data
|
- 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
|
- Overall Summary
|
||||||
- Market & Price Data (opt)
|
- Market & Price Data (opt)
|
||||||
- News & Market Sentiment (opt)
|
- News & Market Sentiment (opt)
|
||||||
|
|||||||
@@ -79,4 +79,6 @@ Timestamp: {{CURRENT_DATE}}
|
|||||||
- Never modify MarketAgent prices
|
- Never modify MarketAgent prices
|
||||||
- Include all timestamps/sources
|
- Include all timestamps/sources
|
||||||
- Retry failed tasks (max 3)
|
- 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
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Historical: `{Asset, Period: {Start, End}, Data Points, Price Range: {Low, High}
|
|||||||
**MANDATORY RULES:**
|
**MANDATORY RULES:**
|
||||||
1. **Include timestamps** for every price data point
|
1. **Include timestamps** for every price data point
|
||||||
2. **Never fabricate** prices or dates - only report tool outputs
|
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
|
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}}
|
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.
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user