File tree Expand file tree Collapse file tree 3 files changed +81
-1
lines changed Expand file tree Collapse file tree 3 files changed +81
-1
lines changed Original file line number Diff line number Diff line change 1+ . *
2+ ! .gitignore
3+ ! .github
14node_modules /
25dist /
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export function formatFunctionDefinitions(functions: FunctionDef[]) {
6666function formatObjectProperties ( obj : ObjectProp , indent : number ) : string {
6767 const lines = [ ] ;
6868 for ( const [ name , param ] of Object . entries ( obj . properties ?? { } ) ) {
69- if ( param . description ) {
69+ if ( param . description && indent < 2 ) {
7070 lines . push ( `// ${ param . description } ` ) ;
7171 }
7272 if ( obj . required ?. includes ( name ) ) {
Original file line number Diff line number Diff line change @@ -304,6 +304,83 @@ const TEST_CASES: Example[] = [
304304 ] ,
305305 tokens : 106 ,
306306 } ,
307+ {
308+ messages : [ { role : 'user' , content : 'hello' } ] ,
309+ functions : [
310+ {
311+ name : 'function' ,
312+ description : 'description' ,
313+ parameters : {
314+ type : 'object' ,
315+ properties : {
316+ quality : {
317+ type : 'object' ,
318+ properties : {
319+ pros : {
320+ type : 'array' ,
321+ items : {
322+ type : 'string' ,
323+ } ,
324+ description : 'Write 3 points why this text is well written' ,
325+ }
326+ } ,
327+ }
328+ } ,
329+ }
330+ } ] ,
331+ tokens : 46 ,
332+ } ,
333+ {
334+ messages : [ { role : 'user' , content : 'hello' } ] ,
335+ functions : [
336+ {
337+ name : 'function' ,
338+ description : 'desctiption1' ,
339+ parameters : {
340+ type : 'object' ,
341+ description : 'desctiption2' ,
342+ properties : {
343+ mainField : {
344+ type : 'string' ,
345+ description : 'description3' ,
346+ } ,
347+ 'field number one' : {
348+ type : 'object' ,
349+ description : 'description4' ,
350+ properties : {
351+ yesNoField : {
352+ type : 'string' ,
353+ description : 'description5' ,
354+ enum : [
355+ 'Yes' ,
356+ 'No' ,
357+ ] ,
358+ } ,
359+ howIsInteresting : {
360+ type : 'string' ,
361+ description : 'description6' ,
362+ } ,
363+ scoreInteresting : {
364+ type : 'number' ,
365+ description : 'description7' ,
366+ } ,
367+ isInteresting : {
368+ type : 'string' ,
369+ description : 'description8' ,
370+ enum : [
371+ 'Yes' ,
372+ 'No' ,
373+ ] ,
374+ } ,
375+ } ,
376+ } ,
377+ } ,
378+
379+ }
380+ }
381+ ] ,
382+ tokens : 96 ,
383+ }
307384] ;
308385
309386const validateAll = false ;
You can’t perform that action at this time.
0 commit comments