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 {
56
56
/** When OpenAI use functions in the prompt, they format them as TypeScript
57
57
* definitions rather than OpenAPI JSON schemas. This function converts the JSON
58
58
* schemas into TypeScript definitions. */
59
- export function formatFunctionDefinitions ( functions : FunctionDef [ ] ) {
59
+ export function formatFunctionDefinitions ( functions : FunctionDef [ ] ) : string {
60
60
const lines = [ "namespace functions {" , "" ]
61
61
for ( const f of functions ) {
62
62
if ( f . description ) {
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ export function messageTokensEstimate(message: Message): number {
122
122
* @param funcs An array of OpenAI function definitions
123
123
* @returns An estimate for the number of tokens the function definitions will use
124
124
*/
125
- export function functionsTokensEstimate ( funcs : FunctionDef [ ] ) {
125
+ export function functionsTokensEstimate ( funcs : FunctionDef [ ] ) : number {
126
126
const promptDefinitions = formatFunctionDefinitions ( funcs )
127
127
let tokens = stringTokens ( promptDefinitions )
128
128
tokens += 9 // Add nine per completion
Original file line number Diff line number Diff line change 31
31
/* Interop Constraints */
32
32
"isolatedModules" : true ,
33
33
"verbatimModuleSyntax" : true ,
34
+ "isolatedDeclarations" : true ,
34
35
"forceConsistentCasingInFileNames" : true ,
35
36
36
37
/* Type Checking */
You can’t perform that action at this time.
0 commit comments