forked from ray-project/llm-applications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
30 lines (24 loc) · 830 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import requests
# Service specific config
data = {"query": "What is the default batch size for map_batches?"}
base_url = "https://ray-assistant-public-98zsh.cld-kvedzwag2qa8i5bj.s.anyscaleuserdata.com"
# Requests config
path = "/stream"
full_url = f"{base_url}{path}"
resp = requests.post(full_url, json=data)
print(resp.text)
# Constructing the new request data structure with the required 'role' field
data = {
"messages": [
{
"content": "What is the default batch size for map_batches?",
"role": "user", # Assuming 'user' is the correct role value. Adjust if necessary.
}
]
}
# Requests config
path = "/chat"
full_url = f"{base_url}{path}"
# Send POST request to the modified endpoint, including the 'role' field
resp = requests.post(full_url, json=data)
print(resp.text)