Skip to content

Commit

Permalink
tutorial96
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 27, 2024
1 parent 0f9bb5e commit c9da8d2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tutorial96/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from langchain_community.document_loaders import TextLoader
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
from langchain_core.pydantic_v1 import BaseModel,Field

class Reviews(BaseModel):
sentiment: str =Field(description="the sentiment of the text")
emotion: str=Field(description="what is the emotion expressed from text , is satisfied or unsatisfied")
items:str=Field(description="the food , drinks or any the specific items mentioned")

tagging_prompt=ChatPromptTemplate.from_template(
"""
Extract the desired information from the following passage.
Only extraxct the properties mentioned in the "Reviews" function
passage:
{input}
"""
)
llm=ChatOpenAI(model="gpt-4o").with_structured_output(Reviews)
tagging_chain=tagging_prompt|llm

loader=TextLoader(r"C:\Users\welcome\OneDrive\Documents\GitHub\LLMtutorial\tutorial96\review.txt")
docs=loader.load()
reviews=docs[0].page_content.split("\n")
for review in reviews:
response=tagging_chain.invoke({"input":review})
print(response)
10 changes: 10 additions & 0 deletions tutorial96/review.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Absolutely loved the ambiance at Savory Symphony! The roasted duck was cooked to perfection, and the staff was incredibly attentive. A must-visit for any food lover.
What a fantastic experience! The live music perfectly complemented the gourmet dishes, creating a truly symphonic dining experience. The dessert platter is a dream!
Savory Symphony never disappoints! Their wine selection is impressive and pairs wonderfully with their signature seafood dishes. Great spot for a romantic dinner
I took my parents here for their anniversary, and we were all blown away by the quality of the food and service. The chef even came out to greet us!
The brunch menu at Savory Symphony is exceptional. The eggs Benedict with homemade hollandaise is my new favorite.
I was not impressed with the long wait times despite having a reservation. The food was decent, but not worth the hype.
Found the menu to be quite limited and the prices too high for the quality offered. The service was slow, and the waiters seemed overwhelmed.
Had high expectations but left disappointed. The steak was overcooked, and the music was too loud, making conversation difficult.
Not what I expected from a place with such good reviews. The pasta was underseasoned, and the tables were too close together, lacking privacy.
The worst dining experience in a while. The food came out at different times for everyone at our table, and my dish was cold. Will not be returning.
Binary file added tutorial96/tutorial96.pptx
Binary file not shown.

0 comments on commit c9da8d2

Please sign in to comment.