Skip to content

Commit f867e25

Browse files
BaseCallerContext: dataclass w.o. fields -> interface (abstract class), supporting both dataclasses and pydantic
1 parent 637f7fa commit f867e25

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/dbally/context/context.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ast
2-
from dataclasses import dataclass
2+
from abc import ABC
33
from typing import Iterable
44

55
from typing_extensions import Self, TypeAlias
@@ -9,13 +9,12 @@
99
CustomContext: TypeAlias = "BaseCallerContext"
1010

1111

12-
@dataclass
13-
class BaseCallerContext:
12+
class BaseCallerContext(ABC):
1413
"""
15-
Pydantic-based record class. Base class for contexts that are used to pass additional knowledge about
16-
the caller environment to the filters. It is not made abstract for the convinience of IQL parsing.
17-
LLM will always return `BaseCallerContext()` when the context is required and this call will be
18-
later substituted by a proper subclass instance selected based on the filter method signature (type hints).
14+
An interface for contexts that are used to pass additional knowledge about
15+
the caller environment to the filters. LLM will always return `BaseCallerContext()`
16+
when the context is required and this call will be later substituted by an instance of
17+
a class implementing this interface, selected based on the filter method signature (type hints).
1918
"""
2019

2120
@classmethod

0 commit comments

Comments
 (0)