from langchain.chat_models import ChatOpenAI from pydantic import BaseModel, Field from langchain.document_loaders import UnstructuredURLLoader from langchain.chains.openai_functions import create_extraction_chain_pydantic class LLMItem(BaseModel): title: str = Field(description="The simple and concise title of the product") description: str = Field(description="The description of the product") def main(): llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-16k") chain = create_extraction_chain_pydantic(pydantic_schema=LLMItem, llm=llm) loader = UnstructuredURLLoader(urls=["https://www.ebay.com/itm/115834603826"]) data = loader.load() llm_item = chain.run(data) print(llm_item) if __name__ == "__main__": main()