@@ -30,35 +30,10 @@ import {
3030 ThreadListParams ,
3131 Threads ,
3232} from './threads' ;
33- import { APIPromise } from '../../../core/api-promise' ;
34- import { type Uploadable } from '../../../core/uploads' ;
35- import { buildHeaders } from '../../../internal/headers' ;
36- import { RequestOptions } from '../../../internal/request-options' ;
37- import { maybeMultipartFormRequestOptions } from '../../../internal/uploads' ;
3833
3934export class ChatKit extends APIResource {
4035 sessions : SessionsAPI . Sessions = new SessionsAPI . Sessions ( this . _client ) ;
4136 threads : ThreadsAPI . Threads = new ThreadsAPI . Threads ( this . _client ) ;
42-
43- /**
44- * Upload a ChatKit file
45- *
46- * @example
47- * ```ts
48- * const response = await client.beta.chatkit.uploadFile({
49- * file: fs.createReadStream('path/to/file'),
50- * });
51- * ```
52- */
53- uploadFile ( body : ChatKitUploadFileParams , options ?: RequestOptions ) : APIPromise < ChatKitUploadFileResponse > {
54- return this . _client . post (
55- '/chatkit/files' ,
56- maybeMultipartFormRequestOptions (
57- { body, ...options , headers : buildHeaders ( [ { 'OpenAI-Beta' : 'chatkit_beta=v1' } , options ?. headers ] ) } ,
58- this . _client ,
59- ) ,
60- ) ;
61- }
6237}
6338
6439/**
@@ -100,97 +75,11 @@ export namespace ChatKitWorkflow {
10075 }
10176}
10277
103- /**
104- * Metadata for a non-image file uploaded through ChatKit.
105- */
106- export interface FilePart {
107- /**
108- * Unique identifier for the uploaded file.
109- */
110- id : string ;
111-
112- /**
113- * MIME type reported for the uploaded file. Defaults to null when unknown.
114- */
115- mime_type : string | null ;
116-
117- /**
118- * Original filename supplied by the uploader. Defaults to null when unnamed.
119- */
120- name : string | null ;
121-
122- /**
123- * Type discriminator that is always `file`.
124- */
125- type : 'file' ;
126-
127- /**
128- * Signed URL for downloading the uploaded file. Defaults to null when no download
129- * link is available.
130- */
131- upload_url : string | null ;
132- }
133-
134- /**
135- * Metadata for an image uploaded through ChatKit.
136- */
137- export interface ImagePart {
138- /**
139- * Unique identifier for the uploaded image.
140- */
141- id : string ;
142-
143- /**
144- * MIME type of the uploaded image.
145- */
146- mime_type : string ;
147-
148- /**
149- * Original filename for the uploaded image. Defaults to null when unnamed.
150- */
151- name : string | null ;
152-
153- /**
154- * Preview URL that can be rendered inline for the image.
155- */
156- preview_url : string ;
157-
158- /**
159- * Type discriminator that is always `image`.
160- */
161- type : 'image' ;
162-
163- /**
164- * Signed URL for downloading the uploaded image. Defaults to null when no download
165- * link is available.
166- */
167- upload_url : string | null ;
168- }
169-
170- /**
171- * Represents either a file or image attachment.
172- */
173- export type ChatKitUploadFileResponse = FilePart | ImagePart ;
174-
175- export interface ChatKitUploadFileParams {
176- /**
177- * Binary file contents to store with the ChatKit session. Supports PDFs and PNG,
178- * JPG, JPEG, GIF, or WEBP images.
179- */
180- file : Uploadable ;
181- }
182-
18378ChatKit . Sessions = Sessions ;
18479ChatKit . Threads = Threads ;
18580
18681export declare namespace ChatKit {
187- export {
188- type ChatKitWorkflow as ChatKitWorkflow ,
189- type FilePart as FilePart ,
190- type ImagePart as ImagePart ,
191- type ChatKitUploadFileResponse as ChatKitUploadFileResponse ,
192- type ChatKitUploadFileParams as ChatKitUploadFileParams ,
193- } ;
82+ export { type ChatKitWorkflow as ChatKitWorkflow } ;
19483
19584 export { Sessions as Sessions , type SessionCreateParams as SessionCreateParams } ;
19685
0 commit comments