Remove JSON chicanery in LLM handling

This commit is contained in:
Cyber MacGeddon 2024-09-05 20:45:13 +01:00
parent 8819bbc467
commit 13005791f7
5 changed files with 3 additions and 18 deletions

View file

@ -134,10 +134,7 @@ class Processor(ConsumerProducer):
print("Send response...", flush=True)
resp = response.replace("```json", "")
resp = resp.replace("```", "")
r = TextCompletionResponse(response=resp, error=None)
r = TextCompletionResponse(response=response, error=None)
self.producer.send(r, properties={"id": id})
except TooManyRequests:

View file

@ -213,13 +213,10 @@ class Processor(ConsumerProducer):
print(outputtext, flush=True)
resp = outputtext.replace("```json", "")
resp = resp.replace("```", "")
print("Send response...", flush=True)
r = TextCompletionResponse(
error=None,
response=resp
response=outputtext
)
self.send(r, properties={"id": id})

View file

@ -93,9 +93,6 @@ class Processor(ConsumerProducer):
resp = output.text
print(resp, flush=True)
resp = resp.replace("```json", "")
resp = resp.replace("```", "")
print("Send response...", flush=True)
r = TextCompletionResponse(response=resp, error=None)
self.send(r, properties={"id": id})

View file

@ -87,10 +87,7 @@ class Processor(ConsumerProducer):
print("Send response...", flush=True)
resp = response.replace("```json", "")
resp = resp.replace("```", "")
r = TextCompletionResponse(response=resp, error=None)
r = TextCompletionResponse(response=response, error=None)
self.send(r, properties={"id": id})

View file

@ -148,9 +148,6 @@ class Processor(ConsumerProducer):
resp = resp.text
resp = resp.replace("```json", "")
resp = resp.replace("```", "")
print("Send response...", flush=True)
r = TextCompletionResponse(