FD900 commited on
Commit
4b90da4
·
verified ·
1 Parent(s): 1c4cf5d

Create mistral_inference.py

Browse files
Files changed (1) hide show
  1. mistral_inference.py +10 -0
mistral_inference.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+
3
+ def query_mistral(api_url, headers, system_prompt, user_prompt):
4
+ payload = {
5
+ "inputs": f"<s>[INST] {system_prompt}\n\n{user_prompt} [/INST]",
6
+ }
7
+
8
+ response = requests.post(api_url, headers=headers, json=payload)
9
+ response.raise_for_status()
10
+ return response.json()["generated_text"]