-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add Cohere plugin for LiveKit Agents #4220
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
base: main
Are you sure you want to change the base?
Conversation
| "command-light-nightly", | ||
| ] | ||
|
|
||
| EmbeddingModels = Literal[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that embedding models can be used in voice calls
|
Hello, and thank you for your PR! |
Hi @Hormold thanks for your message! I will. 😄 |
|
Hey! Tested the Cohere integration and found two issues that need fixing before this can work properly with voice agents. First, Cohere API returns 400: message must be at least 1 token long when there's no user message in the chat context. This happens in voice agents when generate_reply(instructions="...") is called without user input (like in on_enter() to greet the user). OpenAI handles this fine but Cohere doesn't... looks like Cohere requires at least one user message to generate a response. Second, tool calling breaks with 400: schema 'type' must be a string. Array 'type' is unsupported for this model. Cohere's OpenAI-compatible API seems to have stricter JSON schema requirements than OpenAI - it doesn't accept union/array types that LiveKit generates for function tools. Need to figure out what schema format Cohere actually expects and adapt the tool serialization. |
|
Thanks for the feedback! |
|
I took a look at the first issue. One idea: we could add a check in the chat method (Cohere-only) to see if there’s at least one user message in the context. If not, we either auto-inject a small placeholder user message (e.g. “Hello”) so Cohere is happy, or just throw an exception instead. Not sure which direction makes more sense here, but this would at least guarantee we don’t hit that 400 on empty contexts. |
|
I dug into the second issue as well. Ended up fixing it by setting _strict_tool_schema=False for Cohere. |
@Hormold can you confirm? |
|
@Hormold pushed the Cohere issues fix, PR is ready for review. |
|
Hey, I tested, and the PR looks good. One minor thing is a conflict here. Also, I encountered a couple of timeouts on Cohere responses. |
|
Merge break imports. Could you please add ChatMessage to imports again? |
Thanks for testing! Regarding the timeouts - Cohere API can have high latency (25+ seconds TTFT) which may cause timeout errors in real-time applications. Consider:
I also updated the latest Cohere Command models (text generation). |
|
Thanks! Works great! |
Thanks for the feedback! Glad it's working well. |

No description provided.