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

[BUG] #9

Closed
phamxtien opened this issue Jun 29, 2024 · 3 comments
Closed

[BUG] #9

phamxtien opened this issue Jun 29, 2024 · 3 comments
Labels
good first issue Good for newcomers

Comments

@phamxtien
Copy link

phamxtien commented Jun 29, 2024

On OS: Ubuntu 24.04 LST, Python3.12

I got error with below code:

from shuttleai import ShuttleAI

api_key = 'my api key'
base_url = 'https://api.shuttleai.app/v1'
model = 'my model'

def shuttleaiChat(prompt='hi', id=''):
    try:
        client = ShuttleAI(api_key=api_key, base_url=base_url)
        messages = [{"role": "user", "content": prompt}]        
        chat_completion = client.chat.completions.create(messages=messages, model=model)
        response = chat_completion.choices[0].message.content
        return response
    except Exception as e:
        return str(e)

It returns:

Status: 524. Message: \n\n\n\n \n\n\n\n<title>api.shuttleai.app | 524: A timeout occurred</title>\n\n\n\n\n\n\n\n\n\n\n

\n
\n \n

\n A timeout occurred\n Error code 524\n

\n
\n Visit cloudflare.com for more information.\n
\n
2024-06-29 12:50:09 UTC
\n \n
\n
\n
\n \n
\n
\n \n \n \n \n
\n You\n

\n \n Browser\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n Hong Kong\n

\n \n Cloudflare\n \n

\n Working\n
\n\n
\n
\n \n \n \n \n
\n api.shuttleai.app\n

\n \n Host\n \n

\n Error\n
\n\n
\n
\n
\n\n
\n
\n
\n

What happened?

\n

The origin web server timed out responding to this request.

\n
\n
\n

What can I do?

\n

If you're a visitor of this website:

\n

Please try again in a few minutes.

\n\n

If you're the owner of this website:

\n

The connection to the origin web server was made, but the origin web server timed out before responding. The likely cause is an overloaded background task, database or application, stressing the resources on your web server. To resolve, please work with your hosting provider or web development team to free up resources for your database or overloaded application. Additional troubleshooting information here.

\n
\n
\n
\n\n
\n

\n Cloudflare Ray ID: 89b607f67b6385da\n \n \n Your IP:\n Click to reveal\n REDACTED\n \n \n Performance & security by Cloudflare\n \n

\n <script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script>\n
\n\n\n
\n
\n\n\n

@phamxtien phamxtien added the bug Something isn't working label Jun 29, 2024
@herumes
Copy link
Member

herumes commented Jun 30, 2024

Hello, thank you for reporting the issue you encountered.

This seems to have been temporary and resolved.

Additionally, you may increase the timeout by passing "timeout=your new timeout here" when constructing the ShuttleAI client.

Let me know if there's any other issues or you have any questions, thank you for using ShuttleAI! 💙

(P.S be careful sending cloudflare errors in full like this, it typically contains your home network IP address that may be used maliciously by attackers! I have done you the favor of redacting the IP address in the error you provided.)

(P.P.S it is not recommended to create a new client on every request, although typically fine, you will receive great performance benefits by initiating a single ShuttleAI client and using that in your functions)

@phamxtien
Copy link
Author

It seams the API can not pass cloudflare, it still returns 524 error code with timeout=2000

@herumes
Copy link
Member

herumes commented Jul 1, 2024

I am saddened to hear your experience. The API is working perfectly fine for me, please join our discord @ https://discord.gg/shuttleai for more support and assistance. We can discuss further there, my tag is @3thoth. I will be closing this issue as it is unrelated to the lib 💙

@herumes herumes closed this as completed Jul 1, 2024
@herumes herumes added good first issue Good for newcomers and removed bug Something isn't working labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants