File tree Expand file tree Collapse file tree 3 files changed +3
-2
lines changed Expand file tree Collapse file tree 3 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export function isAnyOfProp(prop: Prop): prop is AnyOfProp {
5656/** When OpenAI use functions in the prompt, they format them as TypeScript
5757 * definitions rather than OpenAPI JSON schemas. This function converts the JSON
5858 * schemas into TypeScript definitions. */
59- export function formatFunctionDefinitions ( functions : FunctionDef [ ] ) {
59+ export function formatFunctionDefinitions ( functions : FunctionDef [ ] ) : string {
6060 const lines = [ "namespace functions {" , "" ]
6161 for ( const f of functions ) {
6262 if ( f . description ) {
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export function messageTokensEstimate(message: Message): number {
122122 * @param funcs An array of OpenAI function definitions
123123 * @returns An estimate for the number of tokens the function definitions will use
124124 */
125- export function functionsTokensEstimate ( funcs : FunctionDef [ ] ) {
125+ export function functionsTokensEstimate ( funcs : FunctionDef [ ] ) : number {
126126 const promptDefinitions = formatFunctionDefinitions ( funcs )
127127 let tokens = stringTokens ( promptDefinitions )
128128 tokens += 9 // Add nine per completion
Original file line number Diff line number Diff line change 3131 /* Interop Constraints */
3232 "isolatedModules" : true ,
3333 "verbatimModuleSyntax" : true ,
34+ "isolatedDeclarations" : true ,
3435 "forceConsistentCasingInFileNames" : true ,
3536
3637 /* Type Checking */
You can’t perform that action at this time.
0 commit comments