@@ -28,10 +28,10 @@ public function create(array $parameters): AssistantResponse
2828 {
2929 $ payload = Payload::create ('assistants ' , $ parameters );
3030
31- /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $response */
32- $ response = $ this ->transporter ->requestObject ($ payload );
31+ /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $responseRaw */
32+ $ responseRaw = $ this ->transporter ->requestObject ($ payload );
3333
34- $ response = AssistantResponse::from ($ response ->data (), $ response ->meta ());
34+ $ response = AssistantResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
3535
3636 $ this ->event (new RequestHandled ($ payload , $ response ));
3737
@@ -47,10 +47,14 @@ public function retrieve(string $id): AssistantResponse
4747 {
4848 $ payload = Payload::retrieve ('assistants ' , $ id );
4949
50- /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $response */
51- $ response = $ this ->transporter ->requestObject ($ payload );
50+ /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $responseRaw */
51+ $ responseRaw = $ this ->transporter ->requestObject ($ payload );
5252
53- return AssistantResponse::from ($ response ->data (), $ response ->meta ());
53+ $ response = AssistantResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
54+
55+ $ this ->event (new RequestHandled ($ payload , $ response ));
56+
57+ return $ response ;
5458 }
5559
5660 /**
@@ -64,10 +68,14 @@ public function modify(string $id, array $parameters): AssistantResponse
6468 {
6569 $ payload = Payload::modify ('assistants ' , $ id , $ parameters );
6670
67- /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $response */
68- $ response = $ this ->transporter ->requestObject ($ payload );
71+ /** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}> $responseRaw */
72+ $ responseRaw = $ this ->transporter ->requestObject ($ payload );
6973
70- return AssistantResponse::from ($ response ->data (), $ response ->meta ());
74+ $ response = AssistantResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
75+
76+ $ this ->event (new RequestHandled ($ payload , $ response ));
77+
78+ return $ response ;
7179 }
7280
7381 /**
@@ -79,10 +87,14 @@ public function delete(string $id): AssistantDeleteResponse
7987 {
8088 $ payload = Payload::delete ('assistants ' , $ id );
8189
82- /** @var Response<array{id: string, object: string, deleted: bool}> $response */
83- $ response = $ this ->transporter ->requestObject ($ payload );
90+ /** @var Response<array{id: string, object: string, deleted: bool}> $responseRaw */
91+ $ responseRaw = $ this ->transporter ->requestObject ($ payload );
8492
85- return AssistantDeleteResponse::from ($ response ->data (), $ response ->meta ());
93+ $ response = AssistantDeleteResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
94+
95+ $ this ->event (new RequestHandled ($ payload , $ response ));
96+
97+ return $ response ;
8698 }
8799
88100 /**
@@ -96,10 +108,14 @@ public function list(array $parameters = []): AssistantListResponse
96108 {
97109 $ payload = Payload::list ('assistants ' , $ parameters );
98110
99- /** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}> $response */
100- $ response = $ this ->transporter ->requestObject ($ payload );
111+ /** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, model: string, instructions: ?string, tools: array<int, array{type: 'code_interpreter'}|array{type: 'retrieval'}|array{type: 'function', function: array{description: string, name: string, parameters: array<string, mixed>}}>, file_ids: array<int, string>, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}> $responseRaw */
112+ $ responseRaw = $ this ->transporter ->requestObject ($ payload );
101113
102- return AssistantListResponse::from ($ response ->data (), $ response ->meta ());
114+ $ response = AssistantListResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
115+
116+ $ this ->event (new RequestHandled ($ payload , $ response ));
117+
118+ return $ response ;
103119 }
104120
105121 /**
@@ -109,6 +125,6 @@ public function list(array $parameters = []): AssistantListResponse
109125 */
110126 public function files (): AssistantsFilesContract
111127 {
112- return new AssistantsFiles ($ this ->transporter );
128+ return new AssistantsFiles ($ this ->transporter , $ this -> events );
113129 }
114130}
0 commit comments