diff --git a/README.md b/README.md index 82df3f0..dd08624 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ which would lead to this in your prompt: - `None` - no structured output is used (equals to toggle being in off state) - `Function calling` - hacky way of implementing structured outputs before `Response format` was implemented into API - `Response format` - new way of implementing structured outputs -4. Provide JSON schema in `json schema` text input (can be generated from `pydantic` model or `zod` if you use `nodejs`): +4. Provide JSON schema in `json schema` text input (can be generated from `pydantic` model or `zod` if you use `nodejs`) where `title` must satisfy `'^[a-zA-Z0-9_-]+$'`: ```json { "title": "get_delivery_date", diff --git a/prompterator/utils.py b/prompterator/utils.py index eed1ff1..e94273d 100644 --- a/prompterator/utils.py +++ b/prompterator/utils.py @@ -382,14 +382,10 @@ def format_traceback_for_markdown(text): return re.sub(r"\n", "\n\n", text) -def normalize_name(name: str): - return re.sub("[^a-zA-Z0-9_]", "_", name).lower() - - def build_function_calling_tooling(json_schema): schema = json.loads(json_schema) function = schema.copy() - function_name = normalize_name(function.pop("title")) + function_name = function.pop("title") description = ( function.pop("description") if function.get("description", None) is not None @@ -411,7 +407,7 @@ def build_function_calling_tooling(json_schema): def build_response_format(json_schema): json_schema = json.loads(json_schema) - schema = {"name": normalize_name(json_schema.pop("title")), "schema": json_schema, "strict": True} + schema = {"name": json_schema.pop("title"), "schema": json_schema, "strict": True} response_format = {"type": "json_schema", "json_schema": schema} return response_format