client icon indicating copy to clipboard operation
client copied to clipboard

[file_search]: Do we have to wait for the v2 API to get file_search?

Open Damien514 opened this issue 9 months ago • 3 comments

Description

When I test my assistant in the Playground, it gets my data from my files Vector Stores and can answer all of my questions related to people in my organization. When I ask the same question using my PHP script, it always says it has no info on this person. Does it means that "file_search" is not possible for the moment with the v1 API ?

I know, that's not a bug, more a question, sorry for that!

Steps To Reproduce

In my PHP:

  1. Create a thread $response = $client->threads()->create([]);
  2. Create a message
$response = $client->threads()->messages()->create($threadId,
	[
		'role' => 'user',
		'content' => $obj
	]
);
  1. Run
$response = $client->threads()->runs()->create(
	threadId: $threadId,
	parameters: [
		'assistant_id' => 'asst_xxxxxxxxxx',
	],
);
  1. Retrieve my run
$response = $client->threads()->runs()->retrieve(
		threadId: $threadId,
		runId: $runId,
	);
  1. get the answer $response = $client->threads()->messages()->list($threadId, ['limit' => 1,]);

OpenAI PHP Client Version

v.0.8.5

PHP Version

8.1

Notes

Thanks!

Damien514 avatar May 13 '24 22:05 Damien514

Did you try to create assistant with tools with 'type' => 'file_search'? I think vector store id defining in this method - https://platform.openai.com/docs/api-reference/assistants/createAssistant only fyi - https://platform.openai.com/docs/api-reference/vector-stores/object

GrayHoax avatar May 14 '24 07:05 GrayHoax

Hey @Damien514 ,

Since this SDK is only using V1 of the assistants API at the moment then you may need to attach the file to the assistant using the API rather than the OpenAI interface. Have you tried something along these lines?

$client->assistants()->modify('asst_xxxxxxxxxx', [
    'file_ids' => ['file-xxx']
]);

knash94 avatar May 14 '24 07:05 knash94

Also interested. I am attaching files to the assistant for the time being, which works for the code interpreter, but the SDK throws an error trying to use "file_search" as a tool value in all contexts I've tried.

stephenr85 avatar May 14 '24 17:05 stephenr85

It seems to me that this is just a naming issue; file_search was previously named retrieval. Try retrieval when using v1 API

rkuhl avatar May 20 '24 07:05 rkuhl

Release for assistants v2 has arrived (beta). 🚀

https://github.com/openai-php/client/releases/tag/v0.10.0-beta.1

gehrisandro avatar May 27 '24 20:05 gehrisandro