Skip to content

Commit

Permalink
refactor: remove unnecessary logging from LiteLLM initialization
Browse files Browse the repository at this point in the history
- Removed logging of model configuration to avoid redundancy.

chore: remove OpenAI key management module

- Deleted the `openai_key_pool.py` file and related imports.
- Removed associated test cases and references.

This change simplifies the codebase by eliminating unused functionality.

chore: update contact email in core utilities

- Changed contact email from `[email protected]` to `[email protected]`.

chore: reorganize imports in utility module

- Removed unused imports from `__init__.py`.
- Ensured only necessary modules are exposed in the `__all__` list.

This change improves code readability and maintainability.
  • Loading branch information
Undertone0809 committed Oct 23, 2024
1 parent a4befba commit 8d2961f
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 172 deletions.
2 changes: 1 addition & 1 deletion promptulate/llms/_litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def parse_content(chunk) -> (str, str):

class LiteLLM(BaseLLM):
def __init__(self, model: str, model_config: Optional[dict] = None, **kwargs):
logger.info(f"[pne chat] init LiteLLM, model: {model} config: {model_config}")
logger.info(f"[pne chat] init LiteLLM, model: {model}")
super().__init__(**kwargs)
self._model: str = model
self._model_config: dict = model_config or {}
Expand Down
5 changes: 1 addition & 4 deletions promptulate/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
# Project Link: https://github.com/Undertone0809/promptulate
# Contact Email: [email protected]

from promptulate.utils.color_print import print_text
from promptulate.utils.logger import logger
from promptulate.utils.openai_key_pool import export_openai_key_pool
from promptulate.utils.singleton import AbstractSingleton, Singleton
from promptulate.utils.string_template import StringTemplate

__all__ = ["logger", "export_openai_key_pool", "StringTemplate"]
__all__ = ["logger", "StringTemplate"]
2 changes: 1 addition & 1 deletion promptulate/utils/core_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Copyright Owner: Zeeland
# GitHub Link: https://github.com/Undertone0809/
# Project Link: https://github.com/Undertone0809/promptulate
# Contact Email: zeeland@foxmail.com
# Contact Email: zeeland4work@gmail.com

import logging
import os
Expand Down
163 changes: 0 additions & 163 deletions promptulate/utils/openai_key_pool.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/basic/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def test_import_init():
def test_import_utils():
from promptulate.utils import (
StringTemplate,
export_openai_key_pool,
logger,
)

Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions tests/basic/hook/test_llm.py → tests/old/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def handle_result(*args, **kwargs):
self.assertIsNotNone(result)
print(result)

llm = ChatOpenAI()
llm.set_private_api_key("my key")
llm = ChatOpenAI(api_key="mock key")
llm("What is LLM?")

self.assertTrue(create_flag)
Expand Down

0 comments on commit 8d2961f

Please sign in to comment.