Skip to content

Commit 8bb47c5

Browse files
long line (#8914)
1 parent 6224eb3 commit 8bb47c5

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

dspy/adapters/base.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@
1818

1919
_DEFAULT_NATIVE_RESPONSE_TYPES = [Citations]
2020

21+
2122
class Adapter:
22-
def __init__(self, callbacks: list[BaseCallback] | None = None, use_native_function_calling: bool = False, native_response_types: list[type[Type]] | None = None):
23+
def __init__(
24+
self,
25+
callbacks: list[BaseCallback] | None = None,
26+
use_native_function_calling: bool = False,
27+
native_response_types: list[type[Type]] | None = None,
28+
):
2329
self.callbacks = callbacks or []
2430
self.use_native_function_calling = use_native_function_calling
2531
self.native_response_types = native_response_types or _DEFAULT_NATIVE_RESPONSE_TYPES
@@ -68,7 +74,11 @@ def _call_preprocess(
6874

6975
# Handle custom types that use native response
7076
for name, field in signature.output_fields.items():
71-
if isinstance(field.annotation, type) and issubclass(field.annotation, Type) and field.annotation in self.native_response_types:
77+
if (
78+
isinstance(field.annotation, type)
79+
and issubclass(field.annotation, Type)
80+
and field.annotation in self.native_response_types
81+
):
7282
signature = signature.delete(name)
7383

7484
return signature
@@ -117,7 +127,11 @@ def _call_postprocess(
117127

118128
# Parse custom types that does not rely on the adapter parsing
119129
for name, field in original_signature.output_fields.items():
120-
if isinstance(field.annotation, type) and issubclass(field.annotation, Type) and field.annotation in self.native_response_types:
130+
if (
131+
isinstance(field.annotation, type)
132+
and issubclass(field.annotation, Type)
133+
and field.annotation in self.native_response_types
134+
):
121135
value[name] = field.annotation.parse_lm_response(output)
122136

123137
if output_logprobs:
@@ -404,7 +418,6 @@ def _get_tool_call_output_field_name(self, signature: type[Signature]) -> bool:
404418
return name
405419
return None
406420

407-
408421
def format_conversation_history(
409422
self,
410423
signature: type[Signature],

0 commit comments

Comments
 (0)