Skip to content

Commit 820066d

Browse files
type hint fix: explcitly marked BaseCallerContext.alias as typing.ClassVar
1 parent 2e1005a commit 820066d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/dbally/context/context.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ast
22
from abc import ABC
3-
from typing import Iterable
3+
from typing import ClassVar, Iterable
44

55
from typing_extensions import Self, TypeAlias
66

@@ -15,9 +15,12 @@ class BaseCallerContext(ABC):
1515
the caller environment to the filters. LLM will always return `Context()`
1616
when the context is required and this call will be later substituted by an instance of
1717
a class implementing this interface, selected based on the filter method signature (type hints).
18+
19+
Attributes:
20+
alias: Class variable defining an alias which is defined in the prompt for the LLM to reference context.
1821
"""
1922

20-
alias: str = "AskerContext"
23+
alias: ClassVar[str] = "AskerContext"
2124

2225
@classmethod
2326
def select_context(cls, contexts: Iterable[CustomContext]) -> Self:
@@ -38,8 +41,8 @@ class by its right instance.
3841

3942
if not contexts:
4043
raise ContextNotAvailableError(
41-
"The LLM detected that the context is required to execute the query +\
42-
and the filter signature allows contextualization while the context was not provided."
44+
"The LLM detected that the context is required to execute the query"
45+
"and the filter signature allows contextualization while the context was not provided."
4346
)
4447

4548
# TODO confirm whether it is possible to design a correct type hints here and skipping `type: ignore`

0 commit comments

Comments
 (0)