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

Empty and redudant "assistant":"" message for external groq API calls #6424

Open
arvislacis opened this issue Dec 19, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working repo/cody

Comments

@arvislacis
Copy link

Version

1.53.1734584341

Describe the bug

I am aware that cody.dev.models is experimental feature but there is an issue with external OpenAI compatible (groq) API calls.

For example, given the following configuration:

    "cody.dev.models": [
        {
            "provider": "groq",
            "model": "llama-3.3-70b",
            "apiKey": "*************",
            "apiEndpoint": "https://api.venice.ai/api/v1/chat/completions"
        }
    ]

The Cody AI chat will fail, returning the 400 Bad Request satus from API provider with error that The last message must have the role "user" or "tool". @PriNova is aware of this issue because we had conversation about this on Discord.

As I debugged then the main cause of the mentioned issues is the fact that Cody AI always appends {"role":"assistant","content":""} as the last message of an API call although the most OpenAI compatible (groq) APIs expect the last message to be with role user.

This issue happens with Venice AI LLM provider..., I believe that some other API providers ignore this last, empty {"role":"assistant","content":""} message and works without problems. Anyways, it would be nice that API calls would be made in unified format, as expected from OpenAI compatible documentations.

Expected behavior

External groq API calls should not include the {"role":"assistant","content":""} message in the messages array sent to the API end-point.

Additional context

Discord conversation: https://discord.com/channels/969688426372825169/1318523844788752386

@arvislacis arvislacis added bug Something isn't working repo/cody labels Dec 19, 2024
Copy link

linear bot commented Dec 19, 2024

@PriNova PriNova self-assigned this Dec 19, 2024
@PriNova
Copy link
Collaborator

PriNova commented Dec 19, 2024

@arvislacis

Thank you for reporting the issue and for the detailed discussion on Discord.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working repo/cody
Projects
None yet
Development

No branches or pull requests

2 participants