cohere-ai / cohere-python

Python Library for Accessing the Cohere API
https://docs.cohere.ai
MIT License
289 stars 63 forks source link

Old Document Issues #567

Open minomizuha opened 2 weeks ago

minomizuha commented 2 weeks ago
for event in stream:
    if event.event_type == "text-generation":
        print(event.text, end='')

Then, apparently, I will throw up an error. It worked when I made it look like the following, but is the document still old...? You don't have to reply, but please confirm when you have time.

if stream and hasattr(response, 'text'):
     generated_text = response.text
else:
     generated_text = "Error: The expected response was not returned. "

By any chance, if was the problem...? Is it probably like this?

if stream and hasattr(response, 'text'):
     generated_text = response.text
else:
     generated_text = "Error: The expected response was not returned. "
print(generated_text)