Update app.py
Browse files
app.py
CHANGED
@@ -108,16 +108,28 @@ retriever = db.as_retriever(
|
|
108 |
|
109 |
|
110 |
# Set up the LLM
|
111 |
-
llm = ChatOpenAI(
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
)
|
120 |
|
|
|
|
|
|
|
|
|
121 |
# Create prompt template with chat history
|
122 |
template = """
|
123 |
You are an expert assistant specializing in the Mawared HR System.
|
@@ -138,6 +150,9 @@ Answer:
|
|
138 |
prompt = ChatPromptTemplate.from_template(template)
|
139 |
|
140 |
# Create the RAG chain with chat history
|
|
|
|
|
|
|
141 |
def create_rag_chain(chat_history: str):
|
142 |
chain = (
|
143 |
{
|
|
|
108 |
|
109 |
|
110 |
# Set up the LLM
|
111 |
+
# llm = ChatOpenAI(
|
112 |
+
# base_url="https://api-inference.huggingface.co/v1/",
|
113 |
+
# temperature=0,
|
114 |
+
# api_key=HF_TOKEN,
|
115 |
+
# model="meta-llama/Llama-3.3-70B-Instruct",
|
116 |
+
# max_tokens=None,
|
117 |
+
# timeout=None
|
118 |
|
119 |
+
# )
|
120 |
+
repo_id = "CohereForAI/c4ai-command-r7b-12-2024"
|
121 |
+
|
122 |
+
llm = HuggingFaceEndpoint(
|
123 |
+
repo_id=repo_id,
|
124 |
+
max_length=8192,
|
125 |
+
temperature=0,
|
126 |
+
huggingfacehub_api_token=HF_TOKEN,
|
127 |
)
|
128 |
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
# Create prompt template with chat history
|
134 |
template = """
|
135 |
You are an expert assistant specializing in the Mawared HR System.
|
|
|
150 |
prompt = ChatPromptTemplate.from_template(template)
|
151 |
|
152 |
# Create the RAG chain with chat history
|
153 |
+
|
154 |
+
|
155 |
+
@spcaes.GPU(600)
|
156 |
def create_rag_chain(chat_history: str):
|
157 |
chain = (
|
158 |
{
|