mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-05 19:32:11 +02:00
Fully working
This commit is contained in:
parent
837f41f010
commit
0db6f94b6e
1 changed files with 3 additions and 6 deletions
|
|
@ -59,9 +59,8 @@ class Processor(ConsumerProducer):
|
|||
|
||||
prompt = v.prompt
|
||||
|
||||
stream = self.cohere.chat_stream(
|
||||
output = self.cohere.chat(
|
||||
model=self.model,
|
||||
#model='c4ai-aya-23-8b',
|
||||
message=prompt,
|
||||
preamble = "You are an AI-assistant chatbot. You are trained to read text and find entities in that text. You respond only with well-formed JSON.",
|
||||
temperature=0.0,
|
||||
|
|
@ -70,10 +69,8 @@ class Processor(ConsumerProducer):
|
|||
connectors=[]
|
||||
)
|
||||
|
||||
for event in stream:
|
||||
if event.event_type == "text-generation":
|
||||
resp = event.text
|
||||
print(resp, flush=True)
|
||||
resp = output.text
|
||||
print(resp, flush=True)
|
||||
|
||||
# Parse output for ```json``` delimiters
|
||||
pattern = r'```json\s*([\s\S]*?)\s*```'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue