| #!/usr/bin/env python3 | |
| import sys | |
| import inspect | |
| print("=== DSPy Interface Fix Verification ===") | |
| print() | |
| try: | |
| import dspy_optimizer | |
| # Check the LocalLM signature | |
| print("LocalLM.__call__ signature:") | |
| sig = inspect.signature(dspy_optimizer.LocalLM.__call__) | |
| print(sig) | |
| print() | |
| # Verify the method accepts messages parameter | |
| lm = dspy_optimizer.LocalLM() | |
| print("β LocalLM created successfully") | |
| # Check if we can call with messages parameter | |
| print("Testing interface compatibility...") | |
| # Test the signature compatibility | |
| import inspect | |
| params = sig.parameters | |
| has_messages = 'messages' in params | |
| has_prompt = 'prompt' in params | |
| print(f"β Has 'messages' parameter: {has_messages}") | |
| print(f"β Has 'prompt' parameter: {has_prompt}") | |
| if has_messages: | |
| messages_param = params['messages'] | |
| print(f"β 'messages' parameter: {messages_param}") | |
| print(f" - Default: {messages_param.default}") | |
| print(f" - Kind: {messages_param.kind}") | |
| print() | |
| print("π DSPy interface compatibility fix successful!") | |
| print("The LocalLM now accepts DSPy's calling pattern: lm(messages=inputs, **kwargs)") | |
| except Exception as e: | |
| print(f"β Error: {e}") | |
| import traceback | |
| traceback.print_exc() | |