Skip to content

Commit

Permalink
fix: ensure the transfer tool is only added if transferOptions is pre…
Browse files Browse the repository at this point in the history
…sent
  • Loading branch information
psanders committed Dec 28, 2024
1 parent cda4511 commit 515ef7a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mods/autopilot/src/createLanguageModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ function createLanguageModel(params: {
const { languageModel: languageModelSettings, conversationSettings } =
assistantConfig;

// Ensure that the transfer tool is only added if the transfer options exist
const tools = languageModelSettings.tools.concat(
assistantConfig.conversationSettings.transferOptions
? [hangupToolDefinition, transferToolDefinition]
: [hangupToolDefinition]
);

return LanguageModelFactory.getLanguageModel(
languageModelSettings.provider,
{
Expand All @@ -48,11 +55,7 @@ function createLanguageModel(params: {
systemTemplate: conversationSettings.systemTemplate,
baseUrl: languageModelSettings.baseUrl!,
knowledgeBase,
tools: [
...languageModelSettings.tools,
hangupToolDefinition,
transferToolDefinition
]
tools
},
voice,
telephonyContext
Expand Down

0 comments on commit 515ef7a

Please sign in to comment.