Skip to content

Commit

Permalink
improve model auto-recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyMenshykh committed Jan 23, 2025
1 parent d9adf37 commit 8538a0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ private static bool TryValidateFunctionCall(
// Check if the function call has an exception.
if (functionCall.Exception is not null)
{
errorMessage = $"Error: Function call processing failed. {functionCall.Exception.Message}";
errorMessage = $"Error: Function call processing failed. Correct yourself. {functionCall.Exception.Message}";
return false;
}

// Make sure the requested function is one of the functions that was advertised to the AI model.
if (!checkIfFunctionAdvertised(functionCall))
{
errorMessage = "Error: Function call request for a function that wasn't defined.";
errorMessage = "Error: Function call request for a function that wasn't defined. Correct yourself.";
return false;
}

Expand All @@ -330,7 +330,7 @@ private static bool TryValidateFunctionCall(
return true;
}

errorMessage = "Error: Requested function could not be found.";
errorMessage = "Error: Requested function could not be found. Correct yourself.";
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ await this._sut.ProcessFunctionCallsAsync(

Assert.Equal("MyPlugin", functionResult.PluginName);
Assert.Equal("Function1", functionResult.FunctionName);
Assert.Equal("Error: Function call processing failed. Deserialization failed.", functionResult.Result);
Assert.Equal("Error: Function call processing failed. Correct yourself. Deserialization failed.", functionResult.Result);
}

[Fact]
Expand Down Expand Up @@ -225,7 +225,7 @@ await this._sut.ProcessFunctionCallsAsync(

Assert.Equal("MyPlugin", functionResult.PluginName);
Assert.Equal("Function1", functionResult.FunctionName);
Assert.Equal("Error: Function call request for a function that wasn't defined.", functionResult.Result);
Assert.Equal("Error: Function call request for a function that wasn't defined. Correct yourself.", functionResult.Result);
}

[Fact]
Expand Down Expand Up @@ -253,7 +253,7 @@ await this._sut.ProcessFunctionCallsAsync(

Assert.Equal("MyPlugin", functionResult.PluginName);
Assert.Equal("Function1", functionResult.FunctionName);
Assert.Equal("Error: Requested function could not be found.", functionResult.Result);
Assert.Equal("Error: Requested function could not be found. Correct yourself.", functionResult.Result);
}

[Theory]
Expand Down

0 comments on commit 8538a0e

Please sign in to comment.