@@ -28,10 +28,10 @@ public function create(array $parameters): AssistantResponse
28
28
{
29
29
$ payload = Payload::create ('assistants ' , $ parameters );
30
30
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 );
33
33
34
- $ response = AssistantResponse::from ($ response ->data (), $ response ->meta ());
34
+ $ response = AssistantResponse::from ($ responseRaw ->data (), $ responseRaw ->meta ());
35
35
36
36
$ this ->event (new RequestHandled ($ payload , $ response ));
37
37
@@ -47,10 +47,14 @@ public function retrieve(string $id): AssistantResponse
47
47
{
48
48
$ payload = Payload::retrieve ('assistants ' , $ id );
49
49
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 );
52
52
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 ;
54
58
}
55
59
56
60
/**
@@ -64,10 +68,14 @@ public function modify(string $id, array $parameters): AssistantResponse
64
68
{
65
69
$ payload = Payload::modify ('assistants ' , $ id , $ parameters );
66
70
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 );
69
73
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 ;
71
79
}
72
80
73
81
/**
@@ -79,10 +87,14 @@ public function delete(string $id): AssistantDeleteResponse
79
87
{
80
88
$ payload = Payload::delete ('assistants ' , $ id );
81
89
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 );
84
92
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 ;
86
98
}
87
99
88
100
/**
@@ -96,10 +108,14 @@ public function list(array $parameters = []): AssistantListResponse
96
108
{
97
109
$ payload = Payload::list ('assistants ' , $ parameters );
98
110
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 );
101
113
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 ;
103
119
}
104
120
105
121
/**
@@ -109,6 +125,6 @@ public function list(array $parameters = []): AssistantListResponse
109
125
*/
110
126
public function files (): AssistantsFilesContract
111
127
{
112
- return new AssistantsFiles ($ this ->transporter );
128
+ return new AssistantsFiles ($ this ->transporter , $ this -> events );
113
129
}
114
130
}
0 commit comments