Create endpoints.py
Browse files- endpoints.py +13 -0
endpoints.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
def get_ollam_response(prompt):
|
4 |
+
response = requests.post(
|
5 |
+
"http://localhost:11434/api/generate",
|
6 |
+
json={
|
7 |
+
"model": "wizardcoder",
|
8 |
+
"prompt": prompt,
|
9 |
+
"stream": False
|
10 |
+
}
|
11 |
+
)
|
12 |
+
resp = response.json()
|
13 |
+
return resp["response"], resp["eval_count"]
|