echolabsdev / prism

A unified interface for working with LLMs in Laravel
https://prism.echolabs.dev
MIT License
572 stars 30 forks source link

OpenAI Error Unknown #63

Closed KarimAlii closed 1 hour ago

KarimAlii commented 2 hours ago

This error I just faced it today, is it something related to my network or my internet because it's really says unknown error then the request timed out.

image
pushpak1300 commented 1 hour ago

Need more info. Can you please provide steps to reproduce this error ? Which version you are using and how ?

KarimAlii commented 1 hour ago

"echolabsdev/prism": "^0.10.0"

$response = Prism::text()
    ->using(Provider::OpenAI, 'gpt-4o-mini')
    ->withMessages([$message])
    ->withCLientOptions(['timeout' => 120])
    ->usingTemperature(0)
    ->generate();

the message contains an Image and prompt.

pushpak1300 commented 1 hour ago

I guess there is typo in withCLientOptions this can you rename it to withClientOptions ? I fixed the docs in https://github.com/echolabsdev/prism/pull/64

sixlive commented 1 hour ago

I just ran the following code successfully:

$message = new UserMessage('What is this image?', [
    Image::fromPath('tests/Fixtures/test-image.png'),
]);

$response = Prism::text()
    ->using(Provider::OpenAI, 'gpt-4o-mini')
    ->withMessages([$message])
    ->withClientOptions(['timeout' => 120])
    ->usingTemperature(0)
    ->generate();

dd($response->text);

Response: "The image features a diamond shape, typically representing a diamond gem or a symbol associated with luxury, wealth, or engagement. It is a stylized graphic often used in jewelry design or branding related to diamonds."

sixlive commented 1 hour ago

I guess to address your question more specifically, the last cURL error would lead me to believe it is something related to your connection to OpenAI