from openai import OpenAI from pydantic import BaseModel from typing import List import instructor class Source(BaseModel): title: str url: str description: str class VideoResult(BaseModel): source: List[Source] client = instructor.from_openai( OpenAI( base_url="http://localhost:11434/v1", api_key="ollama" ), mode=instructor.Mode.MD_JSON ) prompt_tmp = """ You are a expert of extracting information of video resouces from a given JSON data. video description should be concise. The JSON data is as follows:{json_data} """ json_data = """{"videoResults":[{"position": 1, "title": "Compilation of great moments from Lisa Ann", "link": "https://www.superporn.com/video/compilation-of-great-moments-from-lisa-ann", "displayed_link": "www.superporn.com \u203a video \u203a compilation-of-great-mo...", "thumbnail": "https://serpapi.com/searches/673594070197dd49870a82bc/images/c66ceefbbee5c6e995e40f8959db96252ab66a9206e7298aed70d3d8706b2b22.jpeg", "date": "Apr 21, 2022", "snippet": "Lisa Ann, the MILF par excellence, showing in this compilation of great porn moments why should be crowned the best MILF of all times.", "duration": "36:19", "rich_snippet": {"top": {"detected_extensions": {"date": "Apr 21, 2022"}, "extensions": ["SuperPorn", "pornstarsfan", "Apr 21, 2022"]}}}, {"position": 2, "title": "BANGBROS - Epic MILF Lisa Ann Cumpilation Video", "link": "https://www.pornhub.com/view_video.php?viewkey=ph60df1edb36bed", "displayed_link": "www.pornhub.com \u203a view_video", "thumbnail": "https://serpapi.com/searches/673594070197dd49870a82bc/images/c66ceefbbee5c6e95ee967ace381311e0e6383ca6a2ba5a13acdac79c0caca36.jpeg", "date": "Jul 2, 2021", "snippet": "Pornhub provides you with unlimited free porn videos with the hottest adult performers. Enjoy the largest amateur porn community on the net as well as full- ...", "duration": "18:22", "rich_snippet": {"top": {"detected_extensions": {"date": "Jul 2, 2021"}, "extensions": ["Pornhub", "Bang Bros Network", "Jul 2, 2021"]}}}, {"position": 3, "title": "Debut Lisa Ann - XVIDEOS.COM", "link": "https://www.xvideos.com/video.hebblod74c5/debut_lisa_ann", "displayed_link": "www.xvideos.com \u203a video.hebblod74c5 \u203a debut_lisa_ann", "thumbnail": "https://serpapi.com/searches/673594070197dd49870a82bc/images/c66ceefbbee5c6e97c0c4c327e01fad4111494caac84fb0bd380db8b0797b944.jpeg", "date": "Dec 10, 2017", "snippet": "Lisa Ann and Jon Dough Best ass ever hot sex. 8 min2.3M views -. 360p \u00b7 Supermodel - Hottest chick in porn! Anyone know her name??? 27 min ...", "duration": "8:23", "rich_snippet": {"top": {"detected_extensions": {"date": "Dec 10, 2017"}, "extensions": ["XVideos", "Dec 10, 2017"]}}}, {"position": 4, "title": "Deep Anal for Lisa", "link": "https://www.superporn.com/video/deep-anal-for-lisa", "displayed_link": "www.superporn.com \u203a video \u203a deep-anal-for-lisa", "thumbnail": "https://serpapi.com/searches/673594070197dd49870a82bc/images/c66ceefbbee5c6e98a642e85ae4a2ab10e5c77d6092ebac2cef8931591b86413.jpeg", "date": "May 17, 2023", "snippet": "Lisa Ann is especially sexy in this porn video in which she will be dressed in a sexy jeweled outfit that highlights her figure and with a super sexy anal ...", "duration": "46:28", "rich_snippet": {"top": {"detected_extensions": {"date": "May 17, 2023"}, "extensions": ["SuperPorn", "ilovemilfs", "May 17, 2023"]}}}, {"position": 5, "title": "HOT MILF Lisa Ann Gets a Neck Full of Cum for Thanksgiving", "link": "https://www.pornhub.com/view_video.php?viewkey=64daddb9bc468", "displayed_link": "www.pornhub.com \u203a view_video", "thumbnail": "https://serpapi.com/searches/673594070197dd49870a82bc/images/c66ceefbbee5c6e9f3dfc2bb4ced2123a576dc21b03a1f61648646dbde9a0faf.jpeg", "date": "Aug 14, 2023", "snippet": "Watch Free Full Video HOT MILF Lisa Ann Gets a Neck Full of Cum for Thanksgiving on Pornhub.com, the best hardcore porn site.", "duration": "31:13", "rich_snippet": {"top": {"detected_extensions": {"date": "Aug 14, 2023"}, "extensions": ["Pornhub", "My Friends Hot Mom", "Aug 14, 2023"]}}}]}""" user_input = prompt_tmp.format(json_data=json_data) user = client.chat.completions.create_partial( model="solonglin/qwen2.5-q6_k-abliterated", messages=[ { "role": "user", "content": user_input } ], response_model=VideoResult ) for i in user: print(i)