-
Notifications
You must be signed in to change notification settings - Fork 826
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix azure openai error strict mode unsupported
- Loading branch information
Showing
5 changed files
with
34 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,8 @@ | ||
from typing import Optional | ||
from pydantic import BaseModel, field_validator, Field | ||
from typing import Dict, Union, Optional | ||
from openai.types.beta.file_search_tool import FileSearchTool | ||
from openai.types.beta.file_search_tool import FileSearch as OpenAIFileSearch | ||
|
||
class FileSearchConfig(BaseModel): | ||
max_num_results: int = Field(50, description="Optional override for the maximum number of results") | ||
ranking_options: Optional[Dict[str, Union[str, float]]] = Field( | ||
{'ranker': 'default_2024_08_21', 'score_threshold': 0.0}, | ||
description="The ranking options for the file search. If not specified, the file search tool will use the auto ranker and a score_threshold of 0." | ||
) | ||
class FileSearchConfig(OpenAIFileSearch): | ||
pass | ||
|
||
@field_validator('max_num_results') | ||
def check_max_num_results(cls, v): | ||
if not 1 <= v <= 50: | ||
raise ValueError('file_search.max_num_results must be between 1 and 50 inclusive') | ||
return v | ||
class FileSearch(BaseModel): | ||
type: str = "file_search" | ||
|
||
file_search: Optional[FileSearchConfig] = None | ||
|
||
class Config: | ||
exclude_none = True | ||
class FileSearch(FileSearchTool): | ||
type: str = "file_search" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
openai==1.41.0 | ||
openai==1.51.2 | ||
docstring_parser==0.16 | ||
pydantic==2.8.2 | ||
datamodel-code-generator==0.25.8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters