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()
new ChatModelFunctionsDocumentationGenerator(chatModelFunctions:
| undefined
| ChatModelFunctions): ChatModelFunctionsDocumentationGenerator
Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:13
Parameters
Parameter | Type |
---|---|
chatModelFunctions | | undefined | ChatModelFunctions |
Returns
ChatModelFunctionsDocumentationGenerator
Properties
chatModelFunctions?
readonly optional chatModelFunctions: ChatModelFunctions;
Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:10
hasAnyFunctions
readonly hasAnyFunctions: boolean;
Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:11
Methods
getTypeScriptFunctionSignatures()
getTypeScriptFunctionSignatures(options: {
documentParams: boolean;
}): string
Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:30
Example:
// Retrieve the current date
function getDate();
// Retrieve the current time
function getTime(params: {hours: "24" | "12", seconds: boolean});
Parameters
Parameter | Type | Description |
---|---|---|
options | { documentParams : boolean ; } | |
options.documentParams ? | boolean | Whether to document the parameters of the functions |
Returns
string
getTypeScriptFunctionTypes()
getTypeScriptFunctionTypes(options: {
documentParams: boolean;
reservedFunctionNames: string[];
}): string
Defined in: chatWrappers/utils/ChatModelFunctionsDocumentationGenerator.ts:73
Example:
// Retrieve the current date
type getDate = () => any;
// Retrieve the current time
type getTime = (_: {hours: "24" | "12", seconds: boolean}) => any;
Parameters
Parameter | Type | Description |
---|---|---|
options | { documentParams : boolean ; reservedFunctionNames : string []; } | |
options.documentParams ? | boolean | Whether to document the parameters of the functions |
options.reservedFunctionNames ? | string [] | Function names that are reserved and cannot be used |
Returns
string
getLlama3_1FunctionSignatures()
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
Parameter | Type | Description |
---|---|---|
options | { documentParams : boolean ; } | |
options.documentParams ? | boolean | Whether to document the parameters of the functions |
Returns
string
getLlama3_2LightweightFunctionSignatures()
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
Parameter | Type | Description |
---|---|---|
options | { documentParams : boolean ; } | |
options.documentParams ? | boolean | Whether to document the parameters of the functions |
Returns
string