Skip to content

Commit

Permalink
Fix typos and documentation (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
sydp authored Dec 23, 2024
1 parent 3fd5684 commit 5a8a470
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion dftimewolf/lib/processors/llm_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def SetUp(self, provider_name: str, model_name: str, task: str) -> None: # pyli
provider_class = llm_manager.LLMProviderManager.GetProvider(
provider_name=provider_name
)
self.provider = provider_class()
self.provider = provider_class() # pytype: disable=not-instantiable
assert self.provider # to appease mypy

if model_name not in self.provider.models:
Expand Down
4 changes: 2 additions & 2 deletions dftimewolf/lib/processors/llmproviders/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def Generate(self, prompt: str, model: str, **kwargs: str) -> str:
The model output.
Raises:
Exception on an error occuring when generating content.
Exception on an error occurring when generating content.
"""
genai_model = self._get_model(model)
try:
Expand Down Expand Up @@ -155,7 +155,7 @@ def GenerateWithHistory(self, prompt: str, model: str, **kwargs: str) -> str:
The model output.
Raises:
Exception on an error occuring when generating content.
Exception on an error occurring when generating content.
"""
if not self.chat_session:
self.chat_session = self._get_model(model).start_chat()
Expand Down
10 changes: 5 additions & 5 deletions dftimewolf/lib/processors/llmproviders/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _LoadConfig(self) -> None:
See /data/config.json for an example.
Raises:
RuntimeError - if there are no configurations for the LLM provider.
RuntimeError: if there are no configurations for the LLM provider.
"""
llm_provider_config = config.Config.GetExtra(BASE_CONFIG_KEY)
if not llm_provider_config:
Expand All @@ -72,7 +72,7 @@ def Generate(self, prompt: str, model: str, **kwargs: str) -> str:
Args:
prompt: The prompt to use for the generation.
model: The provider model to use.
kwargs: Optional keyword arguments to configure the provider.
**kwargs: Optional keyword arguments to configure the provider.
Returns:
The model output.
Expand All @@ -89,7 +89,7 @@ def GenerateFromTemplate(
Args:
template: The prompt template.
model: The provider model to use.
kwargs: Additional keyword arguments to format the template and
**kwargs: Additional keyword arguments to format the template and
optional keyword arguments to configure the provider.
Returns:
Expand All @@ -111,7 +111,7 @@ def GenerateWithHistory(
Args:
prompt: The prompt to use for model generation.
model: The provider model to use.
kwargs: Optional keyword arguments to configure the provider.
**kwargs: Optional keyword arguments to configure the provider.
Returns:
The model output.
Expand All @@ -128,7 +128,7 @@ def GenerateFromTemplateWithHistory(
Args:
template: The prompt template to use for model generation.
model: The provider model to use.
kwargs: Additional keyword arguments to format the template and
**kwargs: Additional keyword arguments to format the template and
optional keyword arguments to configure the provider.
Returns:
Expand Down
2 changes: 1 addition & 1 deletion dftimewolf/lib/processors/llmproviders/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from dftimewolf.lib.providers import interface
from dftimewolf.lib.processors.llmproviders import interface


class LLMProviderManager:
Expand Down
2 changes: 1 addition & 1 deletion dftimewolf/metawolf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def RunInBackground(processes: List['output.MetawolfProcess']) -> bool:
while q not in [False, True]:
value = input('[Yn]? ') or 'y'
q = Str2Bool(str(value))
return q
return q # pytype: disable=bad-return-type
return True


Expand Down
4 changes: 2 additions & 2 deletions tests/lib/processors/llmproviders/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def GenerateWithHistory(self, prompt: str, model: str, **kwargs) -> str:


class LLMProviderManagerTests(unittest.TestCase):
"""Unit tests for the LLMProviderManager"""
"""Unit tests for the LLMProviderManager."""

def testManager(self):
"""Tests the LLMProviderManager"""
"""Tests the LLMProviderManager."""
with self.subTest('not registered'):
with self.assertRaisesRegex(KeyError, 'No such provider'):
manager.LLMProviderManager.GetProvider('test')
Expand Down

0 comments on commit 5a8a470

Please sign in to comment.