Spaces:
Sleeping
Sleeping
Create tailor_chain.py
Browse files- tailor_chain.py +20 -0
tailor_chain.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tailor_chain.py
|
| 2 |
+
import os
|
| 3 |
+
from langchain.chains import LLMChain
|
| 4 |
+
from langchain_groq import ChatGroq
|
| 5 |
+
|
| 6 |
+
from prompts import tailor_prompt
|
| 7 |
+
|
| 8 |
+
def get_tailor_chain() -> LLMChain:
|
| 9 |
+
"""
|
| 10 |
+
Builds the chain that tailors the final response to DailyWellnessAI's style.
|
| 11 |
+
"""
|
| 12 |
+
chat_groq_model = ChatGroq(
|
| 13 |
+
model="Gemma2-9b-It",
|
| 14 |
+
groq_api_key=os.environ["GROQ_API_KEY"]
|
| 15 |
+
)
|
| 16 |
+
chain = LLMChain(
|
| 17 |
+
llm=chat_groq_model,
|
| 18 |
+
prompt=tailor_prompt
|
| 19 |
+
)
|
| 20 |
+
return chain
|