Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -120,13 +120,7 @@ llm = ChatOpenAI(
|
|
| 120 |
timeout=None,
|
| 121 |
max_retries=5,
|
| 122 |
api_key="gl-U2FsdGVkX1/DTLQlsmj+RdJjPy3igB9qINuaX940XtJ0CPnGc/5sbBkPKah/C829", # if you prefer to pass api key in directly instaed of using env vars
|
| 123 |
-
base_url="https://aibe.mygreatlearning.com/openai/v1"
|
| 124 |
-
streaming=False
|
| 125 |
-
)
|
| 126 |
-
|
| 127 |
-
client = OpenAI(
|
| 128 |
-
api_key="gl-U2FsdGVkX1/DTLQlsmj+RdJjPy3igB9qINuaX940XtJ0CPnGc/5sbBkPKah/C829",
|
| 129 |
-
base_url="https://aibe.mygreatlearning.com/openai/v1",
|
| 130 |
)
|
| 131 |
|
| 132 |
|
|
@@ -218,11 +212,10 @@ retriever = vector_store.as_retriever(
|
|
| 218 |
search_kwargs={'k': 5}
|
| 219 |
)
|
| 220 |
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
# )
|
| 226 |
|
| 227 |
@tool
|
| 228 |
def rag(user_input: str) -> str:
|
|
@@ -540,6 +533,7 @@ def chatbot_interface():
|
|
| 540 |
|
| 541 |
try:
|
| 542 |
# Pass the history to the agent
|
|
|
|
| 543 |
response = agent_executor.invoke({"input": conversation_input})
|
| 544 |
# Add the chatbot's response to the history
|
| 545 |
chatbot_response = response['output']
|
|
|
|
| 120 |
timeout=None,
|
| 121 |
max_retries=5,
|
| 122 |
api_key="gl-U2FsdGVkX1/DTLQlsmj+RdJjPy3igB9qINuaX940XtJ0CPnGc/5sbBkPKah/C829", # if you prefer to pass api key in directly instaed of using env vars
|
| 123 |
+
base_url="https://aibe.mygreatlearning.com/openai/v1"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
)
|
| 125 |
|
| 126 |
|
|
|
|
| 212 |
search_kwargs={'k': 5}
|
| 213 |
)
|
| 214 |
|
| 215 |
+
client = OpenAI(
|
| 216 |
+
api_key=api_key,
|
| 217 |
+
base_url=endpoint
|
| 218 |
+
)
|
|
|
|
| 219 |
|
| 220 |
@tool
|
| 221 |
def rag(user_input: str) -> str:
|
|
|
|
| 533 |
|
| 534 |
try:
|
| 535 |
# Pass the history to the agent
|
| 536 |
+
# response = agent_executor.invoke({"input": conversation_input})
|
| 537 |
response = agent_executor.invoke({"input": conversation_input})
|
| 538 |
# Add the chatbot's response to the history
|
| 539 |
chatbot_response = response['output']
|