Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cohere provider #35

Merged
merged 9 commits into from
Apr 15, 2024
Merged

Add Cohere provider #35

merged 9 commits into from
Apr 15, 2024

Conversation

adrienbanse
Copy link
Member

@adrienbanse adrienbanse commented Apr 12, 2024

See #27

Only one thing that's weird. Without EcoLogits being initialized, this piece of code

client = cohere.AsyncClient()
stream = await client.chat_stream(
    message="Tell me a short story", 
    model="command-light", 
    max_tokens=50
)
async for event in stream:
    if event.event_type == "text-generation":
        print(event.text, end='')

throws the error TypeError: object async_generator can't be used in 'await' expression, but works without the await before client.chat_stream. I couldn't find any async stream example, and I'm not familiar with async in Python, so I left it without the await.

@adrienbanse adrienbanse requested a review from samuelrince April 15, 2024 06:18
@samuelrince samuelrince merged commit 6376f59 into main Apr 15, 2024
2 checks passed
@samuelrince samuelrince deleted the feat/cohere branch April 15, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants