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 with Assistants Beta V2 #143

Open
itscvenk opened this issue Jun 1, 2024 · 3 comments
Open

Bug with Assistants Beta V2 #143

itscvenk opened this issue Jun 1, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@itscvenk
Copy link

itscvenk commented Jun 1, 2024

Describe the bug

I used the openAi API playground

I created an assistant, noted the assistant ID. It has an attached file that is used for the file_search. I noted the file_id (starts with vs for a vector store)

The assistant works well on the playground as desired. I have a total of 2 user messages sent and 2 received back from OpenAi

I note the threadID on the playground (starts with thread_)

I use the latest library, with the support for Assistants V2 Beta

When I retrieve the thread & the message using the Open-Ai Orhanerday library, i don't see anything :-(

Same goes when I try to retrieve the files associated with the assistants. Please see below for the codes

Am I doing something wrong or are "files" not yet supported with the assistants V2 beta?

Thanks!

To Reproduce

List assistant files

`use Orhanerday\OpenAi\OpenAi;

try {
$open_ai = new OpenAi('my_API_KEY');
$open_ai->setAssistantsBetaVersion("v2");

$assistantId = 'asst_ID.________';
$query = ['limit' => 100];

$files = $open_ai->listAssistantFiles($assistantId, $query);

} catch (Exception $e) {
echo "Got Error!" . $e->getMessage() . " ";
}

//Results in empty files:

/* list of files
{
"object": "list",
"data": [],
"first_id": null,
"last_id": null,
"has_more": false
}
*/
`

retrieveThread & listThreadMessages

`$threadId = 'thread_ID_____________';

require ($home_dir . '/includes/vendor/autoload.php');

use Orhanerday\OpenAi\OpenAi;

include_once($siteConfig['htmlHeader']);

try {

        $open_ai = new OpenAi('myOpenAiKey');
        $open_ai->setAssistantsBetaVersion("v2");
        
        

        $thread = $open_ai->retrieveThread($threadId);    
        $query = ['limit' => 101];
        $messages = $open_ai->listThreadMessages($threadId, $query);

        echo "<h3>result of thread... is </h3><pre>" . print_r($thread, true) . "</pre>";
        echo "<h3>result of messages in thread $threadId is </h3><pre>" . print_r($thread, true) . "</pre>";

} catch (Exception $e) {
echo "Got Error!" . $e->getMessage() . " ";

}

/* results in empty threads and empty messsages!

result of thread... is
{
"id": "thread_ID_____________",
"object": "thread",
"created_at": 1717219235,
"metadata": {},
"tool_resources": {
"code_interpreter": {
"file_ids": []
}
}
}
result of messages in thread thread_ID_____________ is
{
"id": "thread_ID_____________",
"object": "thread",
"created_at": 1717219235,
"metadata": {},
"tool_resources": {
"code_interpreter": {
"file_ids": []
}
}
}

*/`

OS

PHP Apache

PHP version

PHP Version 7.4.33

Library version

3.5 - 2023-02-10 latest version including V2 assistants Beta:

@itscvenk itscvenk added the bug Something isn't working label Jun 1, 2024
@thomasdv
Copy link

thomasdv commented Jun 1, 2024

@itscvenk I don't know about listing files, but listing messages should work just fine. In your example you are dumping $thread twice instead of $messages.

@itscvenk
Copy link
Author

itscvenk commented Jun 1, 2024

Duhhhhhh.... thanks for spotting it!

@itscvenk itscvenk closed this as completed Jun 1, 2024
@itscvenk itscvenk reopened this Jun 1, 2024
@itscvenk
Copy link
Author

itscvenk commented Jun 1, 2024

Sorry... the listing files is not returning anything

@orhanerday orhanerday reopened this Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants