From 45fbd8afaca9de5f0575cdec9018d77e96611e93 Mon Sep 17 00:00:00 2001 From: noravth Date: Thu, 30 Jul 2026 11:15:30 +0200 Subject: [PATCH] made perplexity one call - quick fix --- .../06-discover-connected-crimes.md | 27 +++++++------------ .../Python/06-discover-connected-crimes.md | 6 ++++- .../solution/investigator_graph.py | 22 ++++++--------- project/Python/solution/config/tasks.yaml | 6 ++++- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/exercises/Python-LangGraph/06-discover-connected-crimes.md b/exercises/Python-LangGraph/06-discover-connected-crimes.md index 4d19527..5f609e4 100644 --- a/exercises/Python-LangGraph/06-discover-connected-crimes.md +++ b/exercises/Python-LangGraph/06-discover-connected-crimes.md @@ -134,21 +134,15 @@ def intelligence_researcher_node(state: AgentState) -> dict: print("\nšŸ” Intelligence Researcher starting web search...") try: - suspects = [s.strip() for s in state["suspect_names"].split(",")] - intelligence_results = [] - - for suspect in suspects: - print(f" Searching public records for: {suspect}") - query = f"{suspect} criminal record art theft security technician Europe background check" - result = call_sonar_pro_search(query) - intelligence_results.append(f"Background check for {suspect}:\n{result}") - - print(" Searching for similar art theft incidents...") - pattern_query = "museum art theft insider job no forced entry Europe similar incidents criminal network" - pattern_result = call_sonar_pro_search(pattern_query) - intelligence_results.append(f"Similar Art Theft Patterns:\n{pattern_result}") + print(f" Searching public records for: {state['suspect_names']}") + query = ( + f"Background check for suspects {state['suspect_names']}: " + f"criminal record, art theft involvement, security technician background, Europe. " + f"Also include similar museum art theft incidents with no forced entry, insider job patterns, criminal networks in Europe." + ) + result = call_sonar_pro_search(query) - raw_results = "Intelligence Research Complete:\n\n" + "\n\n".join(intelligence_results) + raw_results = f"Intelligence Research Complete:\n\n{result}" response = model.invoke([ SystemMessage(content=WEB_RESEARCHER_AGENT["prompt"]), @@ -336,10 +330,7 @@ python .\project\Python-LangGraph\starter-project\main.py > āœ… Evidence analysis complete > > šŸ” Intelligence Researcher starting web search... -> Searching public records for: Sophie Dubois -> Searching public records for: Marcus Chen -> Searching public records for: Viktor Petrov -> Searching for similar art theft incidents... +> Searching public records for: Sophie Dubois, Marcus Chen, Viktor Petrov > āœ… Intelligence research complete > > šŸ” Lead Detective analyzing all findings... diff --git a/exercises/Python/06-discover-connected-crimes.md b/exercises/Python/06-discover-connected-crimes.md index 55385a3..3ff0bbb 100644 --- a/exercises/Python/06-discover-connected-crimes.md +++ b/exercises/Python/06-discover-connected-crimes.md @@ -201,13 +201,17 @@ intelligence_researcher_agent: research_criminal_network: description: > Search the web for intelligence about the three suspects ({suspect_names}) and - related crimes. Use the call_sonar_pro_search tool to find: + related crimes. Use the call_sonar_pro_search tool to find all of the following + in a SINGLE search query that includes all suspect names together: 1. Public criminal records or prior convictions for each suspect 2. Similar art theft incidents with the same modus operandi (insider job, no forced entry) 3. Connections to known art theft rings or criminal networks 4. News reports or public information about any of the suspects 5. Recent museum heists in Europe with similar patterns + Important: combine all suspects and all topics into one search query rather than + searching for each suspect separately. This is more efficient and produces better results. + Cross-reference your web findings with the internal evidence analyzed by the evidence analyst. Focus on discovering whether this is an isolated incident or part of a larger criminal operation. diff --git a/project/Python-LangGraph/solution/investigator_graph.py b/project/Python-LangGraph/solution/investigator_graph.py index 6fb02af..d72571a 100644 --- a/project/Python-LangGraph/solution/investigator_graph.py +++ b/project/Python-LangGraph/solution/investigator_graph.py @@ -159,21 +159,15 @@ def intelligence_researcher_node(state: AgentState) -> dict: print("\nšŸ” Intelligence Researcher starting web search...") try: - suspects = [s.strip() for s in state["suspect_names"].split(",")] - intelligence_results = [] - - for suspect in suspects: - print(f" Searching public records for: {suspect}") - query = f"{suspect} criminal record art theft security technician Europe background check" - result = call_sonar_pro_search(query) - intelligence_results.append(f"Background check for {suspect}:\n{result}") - - print(" Searching for similar art theft incidents...") - pattern_query = "museum art theft insider job no forced entry Europe similar incidents criminal network" - pattern_result = call_sonar_pro_search(pattern_query) - intelligence_results.append(f"Similar Art Theft Patterns:\n{pattern_result}") + print(f" Searching public records for: {state['suspect_names']}") + query = ( + f"Background check for suspects {state['suspect_names']}: " + f"criminal record, art theft involvement, security technician background, Europe. " + f"Also include similar museum art theft incidents with no forced entry, insider job patterns, criminal networks in Europe." + ) + result = call_sonar_pro_search(query) - raw_results = "Intelligence Research Complete:\n\n" + "\n\n".join(intelligence_results) + raw_results = f"Intelligence Research Complete:\n\n{result}" response = model.invoke([ SystemMessage(content=WEB_RESEARCHER_AGENT["prompt"]), diff --git a/project/Python/solution/config/tasks.yaml b/project/Python/solution/config/tasks.yaml index 90ba999..813ea97 100644 --- a/project/Python/solution/config/tasks.yaml +++ b/project/Python/solution/config/tasks.yaml @@ -18,13 +18,17 @@ analyze_evidence_task: research_criminal_network: description: > Search the web for intelligence about the three suspects ({suspect_names}) and - related crimes. Use the call_sonar_pro_search tool to find: + related crimes. Use the call_sonar_pro_search tool to find all of the following + in a SINGLE search query that includes all suspect names together: 1. Public criminal records or prior convictions for each suspect 2. Similar art theft incidents with the same modus operandi (insider job, no forced entry) 3. Connections to known art theft rings or criminal networks 4. News reports or public information about any of the suspects 5. Recent museum heists in Europe with similar patterns + Important: combine all suspects and all topics into one search query rather than + searching for each suspect separately. This is more efficient and produces better results. + Cross-reference your web findings with the internal evidence analyzed by the evidence analyst. Focus on discovering whether this is an isolated incident or part of a larger criminal operation.