From a94421b876874badeb75e5ba80b618934acb39b0 Mon Sep 17 00:00:00 2001 From: Atomie CHEN Date: Wed, 7 Aug 2024 02:19:52 +0800 Subject: [PATCH 1/5] feat(py.typed): add for IDE support --- src/handyllm/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/handyllm/py.typed diff --git a/src/handyllm/py.typed b/src/handyllm/py.typed new file mode 100644 index 0000000..e69de29 From 51d0c32d96852ca06a21559de503f2f926a3cf29 Mon Sep 17 00:00:00 2001 From: Atomie CHEN Date: Wed, 7 Aug 2024 02:21:23 +0800 Subject: [PATCH 2/5] build(pyproject.toml): restore lint rules for __init__.py --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9117e1e..88712a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,6 @@ addopts = [ ] [tool.ruff.lint.per-file-ignores] -# ref: https://github.com/astral-sh/ruff/issues/2407#issuecomment-1974783543 -# Ignore unused imports and import * in __init__.py files -"__init__.py" = ["F401", "F403"] +# # ref: https://github.com/astral-sh/ruff/issues/2407#issuecomment-1974783543 +# # Ignore unused imports and import * in __init__.py files +# "__init__.py" = ["F401", "F403"] From 3e68139bdbfe97e6c9ebe611ba3227a9657b0aab Mon Sep 17 00:00:00 2001 From: Atomie CHEN Date: Wed, 7 Aug 2024 02:21:53 +0800 Subject: [PATCH 3/5] feat(__init__.py): remove import * and use explicit imports --- src/handyllm/__init__.py | 48 +++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/handyllm/__init__.py b/src/handyllm/__init__.py index a7154ec..e6a04f6 100644 --- a/src/handyllm/__init__.py +++ b/src/handyllm/__init__.py @@ -1,10 +1,38 @@ -from .openai_client import * -from .requestor import * -from .openai_api import * -from .endpoint_manager import * -from .prompt_converter import * -from .utils import * -from .types import * -from .hprompt import * -from .cache_manager import * -from .response import * +from .openai_client import OpenAIClient as OpenAIClient, ClientMode as ClientMode +from .requestor import ( + Requestor as Requestor, + DictRequestor as DictRequestor, + BinRequestor as BinRequestor, + ChatRequestor as ChatRequestor, + CompletionsRequestor as CompletionsRequestor, +) +from .openai_api import OpenAIAPI as OpenAIAPI +from .endpoint_manager import EndpointManager as EndpointManager, Endpoint as Endpoint +from .prompt_converter import PromptConverter as PromptConverter +from .utils import ( + stream_chat_all as stream_chat_all, + stream_chat as stream_chat, + stream_completions as stream_completions, + astream_chat_all as astream_chat_all, + astream_chat as astream_chat, + astream_completions as astream_completions, + stream_to_file as stream_to_file, + astream_to_file as astream_to_file, + VM as VM, +) +from .hprompt import ( + HandyPrompt as HandyPrompt, + ChatPrompt as ChatPrompt, + CompletionsPrompt as CompletionsPrompt, + loads as loads, + load as load, + load_from as load_from, + dumps as dumps, + dump as dump, + dump_to as dump_to, + load_var_map as load_var_map, + RunConfig as RunConfig, + RecordRequestMode as RecordRequestMode, + CredentialType as CredentialType, +) +from .cache_manager import CacheManager as CacheManager From 403281fe58fd41a2d3429e2c86d853afe7f1b600 Mon Sep 17 00:00:00 2001 From: Atomie CHEN Date: Wed, 7 Aug 2024 02:22:40 +0800 Subject: [PATCH 4/5] feat(response): add missing items to __all__ --- src/handyllm/response.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/handyllm/response.py b/src/handyllm/response.py index 8c2f346..d5b7982 100644 --- a/src/handyllm/response.py +++ b/src/handyllm/response.py @@ -9,6 +9,15 @@ "CompletionsResponse", "CompletionsChunkChoice", "CompletionsChunk", + "Function", + "ToolCall", + "TopLogProbItem", + "LogProbItem", + "Logprobs", + "Usage", + "ToolCallDelta", + "ChatChunkDelta", + "CompletionLogprobs", ] from typing import List, MutableMapping, Optional, Sequence, TypedDict From 79dee65f1354e2b74b4865fb14d7bb85d161120e Mon Sep 17 00:00:00 2001 From: Atomie CHEN Date: Wed, 7 Aug 2024 02:23:01 +0800 Subject: [PATCH 5/5] build: ignore build folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 62494cf..216a8a7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store dist +build *.egg-info # credentials