Skip to content

Class: ChatModelFunctionsDocumentationGenerator

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:9

Generate documentation about the functions that are available for a model to call. Useful for generating a system message with information about the available functions as part of a chat wrapper.

Constructors

new ChatModelFunctionsDocumentationGenerator()

ts
new ChatModelFunctionsDocumentationGenerator(chatModelFunctions: 
  | undefined
  | ChatModelFunctions): ChatModelFunctionsDocumentationGenerator

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:13

Parameters

ParameterType
chatModelFunctions| undefined | ChatModelFunctions

Returns

ChatModelFunctionsDocumentationGenerator

Properties

chatModelFunctions?

ts
readonly optional chatModelFunctions: ChatModelFunctions;

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:10


hasAnyFunctions

ts
readonly hasAnyFunctions: boolean;

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:11

Methods

getTypeScriptFunctionSignatures()

ts
getTypeScriptFunctionSignatures(options: {
  documentParams: boolean;
 }): string

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:30

Example:

ts
// Retrieve the current date
function getDate();

// Retrieve the current time
function getTime(params: {hours: "24" | "12", seconds: boolean});

Parameters

ParameterTypeDescription
options{ documentParams: boolean; }
options.documentParams?booleanWhether to document the parameters of the functions

Returns

string


getTypeScriptFunctionTypes()

ts
getTypeScriptFunctionTypes(options: {
  documentParams: boolean;
  reservedFunctionNames: string[];
 }): string

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:73

Example:

ts
// Retrieve the current date
type getDate = () => any;

// Retrieve the current time
type getTime = (_: {hours: "24" | "12", seconds: boolean}) => any;

Parameters

ParameterTypeDescription
options{ documentParams: boolean; reservedFunctionNames: string[]; }
options.documentParams?booleanWhether to document the parameters of the functions
options.reservedFunctionNames?string[]Function names that are reserved and cannot be used

Returns

string


getLlama3_1FunctionSignatures()

ts
getLlama3_1FunctionSignatures(options: {
  documentParams: boolean;
 }): string

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:120

Example:

Use the function 'getDate' to: Retrieve the current date
{"name": "getDate", "description": "Retrieve the current date"}

Use the function 'getTime' to: Retrieve the current time
{"name": "getTime", "description": "Retrieve the current time", "parameters": {"type": "object", "properties": {"hours": {"enum": ["24", "12"]}, "seconds": {"type": "boolean"}}}}

Parameters

ParameterTypeDescription
options{ documentParams: boolean; }
options.documentParams?booleanWhether to document the parameters of the functions

Returns

string


getLlama3_2LightweightFunctionSignatures()

ts
getLlama3_2LightweightFunctionSignatures(options: {
  documentParams: boolean;
 }): string

Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:162

Example:

{"name": "getDate", "description": "Retrieve the current date"}

{"name": "getTime", "description": "Retrieve the current time", "parameters": {"type": "object", "properties": {"hours": {"enum": ["24", "12"]}, "seconds": {"type": "boolean"}}}}

Parameters

ParameterTypeDescription
options{ documentParams: boolean; }
options.documentParams?booleanWhether to document the parameters of the functions

Returns

string