From 01f41ecdd09b4473a3d5ab1afcc219b6dede7cfd Mon Sep 17 00:00:00 2001 From: Ben Gitter Date: Sun, 20 Oct 2024 14:32:01 +0000 Subject: [PATCH] removed dependancy on _models.py and add snip from _types.py --- lmos_openai_types/_types.py | 16 ++++++++++++++++ runner.py | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 lmos_openai_types/_types.py diff --git a/lmos_openai_types/_types.py b/lmos_openai_types/_types.py new file mode 100644 index 0000000..d89f732 --- /dev/null +++ b/lmos_openai_types/_types.py @@ -0,0 +1,16 @@ +from typing import Union, Optional, Mapping, IO, Tuple +from os import PathLike + +# manually pulled from OAI +FileContent = Union[IO[bytes], bytes, PathLike[str]] + +FileTypes = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] \ No newline at end of file diff --git a/runner.py b/runner.py index efc29de..13ace9f 100644 --- a/runner.py +++ b/runner.py @@ -56,6 +56,8 @@ def main(): shutil.move(source_dir, dest_dir) shutil.rmtree("openai-package") + run_command("""find lmos_openai_types -type f -name "*.py" -print0 | xargs -0 sed -i 's/^.*import BaseModel.*$/from pydantic import BaseModel/g'""") + # Add all changes run_command("git add .")