DSPy: The framework for programming—not prompting—language models
Python
long line (#8914)
Chen Qian8bb47c5a2013
diff --git a/dspy/adapters/base.py b/dspy/adapters/base.pyindex 5e87867f2..d13b45482 100644--- a/dspy/adapters/base.py+++ b/dspy/adapters/base.py@@ -18,8 +18,14 @@ if TYPE_CHECKING:_DEFAULT_NATIVE_RESPONSE_TYPES = [Citations]+class Adapter:- def __init__(self, callbacks: list[BaseCallback] | None = None, use_native_function_calling: bool = False, native_response_types: list[type[Type]] | None = None):+ def __init__(+ self,+ callbacks: list[BaseCallback] | None = None,+ use_native_function_calling: bool = False,+ native_response_types: list[type[Type]] | None = None,+ ):self.callbacks = callbacks or []self.use_native_function_calling = use_native_function_callingself.native_response_types = native_response_types or _DEFAULT_NATIVE_RESPONSE_TYPES@@ -68,7 +74,11 @@ class Adapter:# Handle custom types that use native responsefor name, field in signature.output_fields.items():- if isinstance(field.annotation, type) and issubclass(field.annotation, Type) and field.annotation in self.native_response_types:+ if (+ isinstance(field.annotation, type)+ and issubclass(field.annotation, Type)+ and field.annotation in self.native_response_types+ ):signature = signature.delete(name)return signature@@ -117,7 +127,11 @@ class Adapter:# Parse custom types that does not rely on the adapter parsingfor name, field in original_signature.output_fields.items():- if isinstance(field.annotation, type) and issubclass(field.annotation, Type) and field.annotation in self.native_response_types:+ if (+ isinstance(field.annotation, type)+ and issubclass(field.annotation, Type)+ and field.annotation in self.native_response_types+ ):value[name] = field.annotation.parse_lm_response(output)if output_logprobs:@@ -404,7 +418,6 @@ class Adapter:return namereturn None-def format_conversation_history(self,signature: type[Signature],