Skip to content

bug: deepseek stream_prompt Invalid status code 415 #1169

@gj-zhang

Description

@gj-zhang
  • [ ✅] I have looked for existing issues (including closed) about this

Bug Report

Error: CompletionError: ResponseError: Invalid status code 415 Unsupported Media Type with message: Expected request with `Content-Type: application/json`

Reproduction

use std::env;
use rig::client::ProviderClient;
use rig::prelude::CompletionClient;
use rig::providers::deepseek;
use rig::providers::deepseek::DEEPSEEK_CHAT;
use rig::streaming::StreamingPrompt;


#[tokio::main]
async fn main() {
    let api_key = "sk-xxxx";
    env::set_var("DEEPSEEK_API_KEY", api_key);
    let client = deepseek::Client::from_env();

    let agent = client.agent(DEEPSEEK_CHAT).preamble("You are a helpful assistant").build();
    let mut answer = agent.stream_prompt("tell me a joke").await;
    rig::agent::stream_to_stdout(&mut answer).await.unwrap();
}

Expected behavior

give me a joke.

Screenshots

Additional context

rig-core: 0.27.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions