Update tailor_chain.py
Browse files- tailor_chain.py +12 -4
tailor_chain.py
CHANGED
|
@@ -1,15 +1,23 @@
|
|
| 1 |
from langchain.chains import LLMChain
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
from prompts import tailor_prompt
|
| 3 |
|
| 4 |
def get_tailor_chain() -> LLMChain:
|
| 5 |
"""
|
| 6 |
-
|
| 7 |
"""
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
prompt=tailor_prompt
|
| 11 |
)
|
| 12 |
-
return
|
| 13 |
|
| 14 |
def tailor_with_history(response: str, chat_history: list) -> str:
|
| 15 |
"""
|
|
|
|
| 1 |
from langchain.chains import LLMChain
|
| 2 |
+
from prompts import tailor_prompt
|
| 3 |
+
import os
|
| 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
|
| 21 |
|
| 22 |
def tailor_with_history(response: str, chat_history: list) -> str:
|
| 23 |
"""
|