summaryrefslogtreecommitdiff
path: root/client.py
diff options
context:
space:
mode:
authorbatsumaru <>2026-09-11 11:38:42 +0900
committerbatsumaru <>2026-09-11 11:38:42 +0900
commit9b51fae7d02669f3d7b43703b5e0b6731d2f32ce (patch)
tree08de40c3774594c3dce5fc462782d28f13c40b6e /client.py
parent98b529ecd1b66dd8d118ee4f485593f7a4475b0c (diff)
Added project file and client
Diffstat (limited to 'client.py')
-rw-r--r--client.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/client.py b/client.py
new file mode 100644
index 0000000..0974650
--- /dev/null
+++ b/client.py
@@ -0,0 +1,39 @@
+import requests
+
+URL = "http://localhost:8080/v1/chat/completions"
+
+messages = []
+
+while True:
+ user_input = input("You: ")
+
+ if user_input.lower() in {"exit", "quit"}:
+ break
+
+ messages.append({
+ "role": "user",
+ "content": user_input
+ })
+
+ response = requests.post(
+ URL,
+ json={
+ "messages": messages,
+ "max_tokens": 256,
+ "temperature": 0.7,
+ }
+ )
+
+ if not response.ok:
+ print("Server error: ", response.text)
+ continue
+
+ data = response.json()
+ answer = data["choices"][0]["message"]["content"]
+
+ print(f"Agent: {answer}")
+
+ messages.append({
+ "role": "assistant",
+ "content": answer
+ })