Spaces:
Sleeping
Sleeping
add response format with json
Browse files
app.py
CHANGED
@@ -69,6 +69,17 @@ Numbers or units related symbols are not included in this range and can be ignor
|
|
69 |
- Present the results in JSON format, like: {"identified_entity" : ["biopsy", "larynx"]}
|
70 |
"""
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
def respond(
|
73 |
message,
|
74 |
history: list[tuple[str, str]],
|
@@ -91,6 +102,7 @@ def respond(
|
|
91 |
|
92 |
for message in client.chat_completion(
|
93 |
messages,
|
|
|
94 |
max_tokens=max_tokens,
|
95 |
stream=True,
|
96 |
temperature=temperature,
|
|
|
69 |
- Present the results in JSON format, like: {"identified_entity" : ["biopsy", "larynx"]}
|
70 |
"""
|
71 |
|
72 |
+
response_format = {
|
73 |
+
"type": "json",
|
74 |
+
"value": {
|
75 |
+
"properties": {
|
76 |
+
"identified_entity": {"type": "array", "items": {"type": "string"}},
|
77 |
+
},
|
78 |
+
"required": ["identified_entity"],
|
79 |
+
},
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
def respond(
|
84 |
message,
|
85 |
history: list[tuple[str, str]],
|
|
|
102 |
|
103 |
for message in client.chat_completion(
|
104 |
messages,
|
105 |
+
response_format=response_format,
|
106 |
max_tokens=max_tokens,
|
107 |
stream=True,
|
108 |
temperature=temperature,
|