@@ -409,11 +409,9 @@ export interface EmbedOptions {
409409export type EmbedResponse = number [ ] [ ] ;
410410
411411export interface ChunkOptions {
412- document : Buffer | File | FormData | ReadableStream ;
413- documentName : string ;
414- contentType : ContentType ;
415- chunkMaxLength ?: string ;
416- chunkOverlap ?: string ;
412+ content : string ;
413+ chunkOverlap ?: number ;
414+ chunkMaxLength ?: number ;
417415}
418416
419417export type ChunkResponse = string [ ] ;
@@ -975,26 +973,10 @@ export class Langbase {
975973 * @returns A promise that resolves to the chunked document response.
976974 */
977975 private async chunkDocument ( options : ChunkOptions ) : Promise < ChunkResponse > {
978- const formData = await convertDocToFormData ( {
979- document : options . document ,
980- documentName : options . documentName ,
981- contentType : options . contentType ,
982- } ) ;
983-
984- if ( options . chunkMaxLength )
985- formData . append ( 'chunkMaxLength' , options . chunkMaxLength ) ;
986- if ( options . chunkOverlap )
987- formData . append ( 'chunkOverlap' , options . chunkOverlap ) ;
988-
989- const response = await fetch ( `${ this . baseUrl } /v1/chunk` , {
990- method : 'POST' ,
991- headers : {
992- Authorization : `Bearer ${ this . apiKey } ` ,
993- } ,
994- body : formData ,
976+ return this . request . post ( {
977+ endpoint : '/v1/chunk' ,
978+ body : options ,
995979 } ) ;
996-
997- return response . json ( ) ;
998980 }
999981
1000982 /**
0 commit comments