Interal error gemini api

pub fn check_state() {
    let tls = TlsConnector::new().unwrap();
    let stream = TcpStream::connect("generativelanguage.googleapis.com:443").unwrap();
    let mut connect = tls
        .connect("generativelanguage.googleapis.com", stream)
        .unwrap();

    let response = format!("GET /v1beta/files/75y4otkc91bu?key={} HTTP/1.1\r\nHost: generativelanguage.googleapis.com\r\n\r\n");

    connect.write_all(response.as_bytes());
    connect.flush();

    let mut buffer = [0; 1024];
    connect.read(&mut buffer);

    let response = String::from_utf8_lossy(&buffer);
    println!("{}", response);
}

HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Vary: X-Origin
Vary: Referer
Date: Wed, 20 Nov 2024 08:13:14 GMT
Server: scaffolding on HTTPServer2
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Server-Timing: gfet4t7; dur=1256
Alt-Svc: h3=“:443”; ma=2592000,h3-29=“:443”; ma=2592000
Accept-Ranges: none
Vary: Origin,Accept-Encoding
Transfer-Encoding: chunked

7b
{
“error”: {
“code”: 500,
“message”: “Failed to convert server response to JSON”,
“status”: “INTERNAL”
}
}

@Hari_Prasath

You can try reducing your input context length or temporarily switch to another model.