-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06741bf
commit 38dcee4
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from funcchain import chain, settings | ||
from langchain_groq import ChatGroq | ||
from pydantic import BaseModel, Field | ||
from rich import print | ||
|
||
|
||
class SentimentAnalysis(BaseModel): | ||
analysis: str = Field(description="A description of the analysis") | ||
sentiment: bool = Field(description="True for Happy, False for Sad") | ||
|
||
|
||
def analyze(text: str) -> SentimentAnalysis: | ||
""" | ||
Determines the sentiment of the text. | ||
""" | ||
return chain() | ||
|
||
|
||
if __name__ == "__main__": | ||
# set global llm | ||
settings.llm = ChatGroq(model="llama3-70b-8192") | ||
# log tokens as stream to console | ||
settings.console_stream = True | ||
|
||
# run prompt | ||
result = analyze("I really like when my dog does a trick!") | ||
|
||
# show final parsed output | ||
print(result) |