Skip to content

Commit

Permalink
Add pydantic.mypy plugin to mypy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hmasdev committed Apr 7, 2024
1 parent 91f688f commit 9bee7ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ markers = ["integrate: integration test"]
[tool.mypy]
warn_return_any = true
warn_unused_configs = true
plugins = "pydantic.mypy"

[[tool.mypy.overrides]]
module = "sshkeyboard"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@ def __init__(
self,
model: str = 'gpt-3.5-turbo-16k',
temperature: float = .7,
openai_api_key: SecretStr | None = None,
openai_api_key: SecretStr | str | None = None,
memory_size: int = 1,
max_retry: int = 5,
logger: Logger = getLogger(__name__),
):
self._max_retry = max_retry

self._llm = ChatOpenAI(
model=model,
temperature=temperature,
api_key=openai_api_key,
openai_api_key=(
openai_api_key.get_secret_value() # type: ignore
if isinstance(openai_api_key, SecretStr) else
openai_api_key
),
)
self._memory = ConversationBufferMemory(k=memory_size) # type: ignore # noqa
self._chain = ConversationChain(llm=self._llm, memory=self._memory) # type: ignore # noqa
Expand Down

0 comments on commit 9bee7ce

Please sign in to comment.