INNER CODE UNIT · Python
ResultItem
essamamdani/search-result-scraper-markdown · main.py:196
class ResultItem(BaseModel):
title: str
url: str
content: str
class SearchResult(BaseModel):
results: List[ResultItem]
system_message = (
'You will be given a JSON format of search results and a search query. '
'Extract only "exact and most" related search `results` based on the `query`. '
'If the "content" field is empty, use the "title" or "url" field to determine relevance. '
f' Return the results in same JSON format as you would be given, the JSON object must use the schema: {json.dumps(SearchResult.schema())}'
)
if AI_ENGINE == "groq":
from groq import Groq
client = Groq()
model = os.getenv('GROQ_MODEL', 'llama3-8b-8192')