mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-13 01:09:04 +08:00
Update o1_web_crawler.py
This commit is contained in:
parent
8c05aed6e9
commit
e58144798f
@ -79,20 +79,19 @@ def find_objective_in_top_pages(map_website, objective, app, client):
|
|||||||
|
|
||||||
# Check if objective is met
|
# Check if objective is met
|
||||||
check_prompt = f"""
|
check_prompt = f"""
|
||||||
Given the following scraped content and objective, determine if the objective is met with high confidence.
|
Given the following scraped content and objective, determine if the objective is met.
|
||||||
If it is, extract the relevant information in a simple and concise JSON format. Use only the necessary fields and avoid nested structures if possible.
|
If it is, extract the relevant information in a simple and concise JSON format. Use only the necessary fields and avoid nested structures if possible.
|
||||||
If the objective is not met with high confidence, respond with 'Objective not met'.
|
If the objective is not met with confidence, respond with 'Objective not met'.
|
||||||
|
|
||||||
Objective: {objective}
|
Objective: {objective}
|
||||||
Scraped content: {scrape_result['markdown']}
|
Scraped content: {scrape_result['markdown']}
|
||||||
|
|
||||||
Remember:
|
Remember:
|
||||||
1. Only return JSON if you are highly confident the objective is fully met.
|
1. Only return JSON if you are confident the objective is fully met.
|
||||||
2. Keep the JSON structure as simple and flat as possible.
|
2. Keep the JSON structure as simple and flat as possible.
|
||||||
3. Do not include any explanations or markdown formatting in your response.
|
3. Do not include any explanations or markdown formatting in your response.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print(f"{Colors.YELLOW}Analyzing scraped content to determine objective fulfillment...{Colors.RESET}")
|
|
||||||
completion = client.chat.completions.create(
|
completion = client.chat.completions.create(
|
||||||
model="o1-preview",
|
model="o1-preview",
|
||||||
messages=[
|
messages=[
|
||||||
@ -121,6 +120,7 @@ def find_objective_in_top_pages(map_website, objective, app, client):
|
|||||||
|
|
||||||
print(f"{Colors.RED}All available pages analyzed. Objective not fulfilled in examined content.{Colors.RESET}")
|
print(f"{Colors.RED}All available pages analyzed. Objective not fulfilled in examined content.{Colors.RESET}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"{Colors.RED}Error encountered during page analysis: {str(e)}{Colors.RESET}")
|
print(f"{Colors.RED}Error encountered during page analysis: {str(e)}{Colors.RESET}")
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user