INNER CODE UNIT · Python

SearchResult

essamamdani/search-result-scraper-markdown · main.py:200

    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')

    else:
        import openai
        client = openai
        model = os.getenv('OPENAI_MODEL', 'gpt-3.5-turbo-0125')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…