Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

chore: Remove dead code with the arrival of GPT-4 0125

Clémence Lesnéf75414a4b67e
diff --git a/models/message.py b/models/message.py
index 0e8e2ec..4c6c785 100644
--- a/models/message.py
+++ b/models/message.py
@@ -96,24 +96,6 @@ class ToolModel(BaseModel):
json_str = self.function_arguments
name = self.function_name
- # Try to fix encoding issues with args and GPT-4 Turbo
- # See:
- # - https://community.openai.com/t/gpt-4-1106-preview-is-not-generating-utf-8/482839/8
- # - https://community.openai.com/t/gpt-4-1106-preview-messes-up-function-call-parameters-encoding/478500/32
- # - https://community.openai.com/t/gpt-4-1106-preview-messes-up-function-call-parameters-encoding/478500/71
- # Fix double escaped unicode (\\u0000 -> \u0000)
- json_str = re.sub(DOUBLE_ESCAPED_UNICODE_R, REMOVE_DOUBLE_ESCAPE_R, json_str)
- # Fix unicode that was not escaped (u0000 -> \u0000)
- json_str = re.sub(
- NON_ESCAPED_UNICODE_R,
- lambda match: "\\" + match.group(0),
- json_str,
- )
- # Unescape % encoded characters (e.g. %20 -> " ") and fix special characters (e.g. ü, é)
- json_str = unquote(json_str, "latin1")
- # Unescape html entities (e.g. ü -> ü)
- json_str = unescape(json_str)
-
# Try to fix JSON args to catch LLM hallucinations
# See: https://community.openai.com/t/gpt-4-1106-preview-messes-up-function-call-parameters-encoding/478500
args: dict[str, Any] = repair_json(