Commit
·
ec59be7
1
Parent(s):
2fbc411
Update chat model initialization in main.py to use "qwen-qwq-32b" and add a new ping function in ping.gs for testing the chatbot API response.
Browse files
main.py
CHANGED
|
@@ -31,7 +31,7 @@ if not os.environ.get("GROQ_API_KEY"):
|
|
| 31 |
# print(f"GROQ_API_KEY: {os.getenv('GROQ_API_KEY')}")
|
| 32 |
# print(f"HUGGING_FACE_API_KEY: {os.getenv('HUGGING_FACE_API_KEY')}")
|
| 33 |
|
| 34 |
-
llm = init_chat_model("
|
| 35 |
'''
|
| 36 |
embeddings = HuggingFaceInferenceAPIEmbeddings(
|
| 37 |
api_key = os.getenv('HUGGING_FACE_API_KEY'),
|
|
|
|
| 31 |
# print(f"GROQ_API_KEY: {os.getenv('GROQ_API_KEY')}")
|
| 32 |
# print(f"HUGGING_FACE_API_KEY: {os.getenv('HUGGING_FACE_API_KEY')}")
|
| 33 |
|
| 34 |
+
llm = init_chat_model("qwen-qwq-32b", model_provider="groq", api_key=os.environ["GROQ_API_KEY"])
|
| 35 |
'''
|
| 36 |
embeddings = HuggingFaceInferenceAPIEmbeddings(
|
| 37 |
api_key = os.getenv('HUGGING_FACE_API_KEY'),
|
ping.gs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function pingChatbot() {
|
| 2 |
+
// Your FastAPI endpoint URL
|
| 3 |
+
var url = "https://amanm10000-mlsc-coherence-25-faq-chatbot-api.hf.space/chat";
|
| 4 |
+
|
| 5 |
+
// Create query parameters
|
| 6 |
+
var params = {
|
| 7 |
+
"question": "Who are the sponsors baby?"
|
| 8 |
+
};
|
| 9 |
+
|
| 10 |
+
// Build URL with query parameters
|
| 11 |
+
var queryString = Object.keys(params)
|
| 12 |
+
.map(key => key + '=' + encodeURIComponent(params[key]))
|
| 13 |
+
.join('&');
|
| 14 |
+
var fullUrl = url + '?' + queryString;
|
| 15 |
+
|
| 16 |
+
// Request options
|
| 17 |
+
var options = {
|
| 18 |
+
"method": "get",
|
| 19 |
+
"muteHttpExceptions": true
|
| 20 |
+
};
|
| 21 |
+
|
| 22 |
+
try {
|
| 23 |
+
// Make the request
|
| 24 |
+
var response = UrlFetchApp.fetch(fullUrl, options);
|
| 25 |
+
|
| 26 |
+
// Get response code and content
|
| 27 |
+
var responseCode = response.getResponseCode();
|
| 28 |
+
var responseText = response.getContentText();
|
| 29 |
+
|
| 30 |
+
// Log the response
|
| 31 |
+
Logger.log("Response Code: " + responseCode);
|
| 32 |
+
Logger.log("Response: " + responseText);
|
| 33 |
+
|
| 34 |
+
return responseText;
|
| 35 |
+
|
| 36 |
+
} catch (error) {
|
| 37 |
+
Logger.log("Error: " + error.toString());
|
| 38 |
+
return "Error: " + error.toString();
|
| 39 |
+
}
|
| 40 |
+
}
|