55"""
66
77import functools
8+ import inspect
89import json
910import os
1011from collections .abc import Callable
2526 call_assistant ,
2627 completion ,
2728)
29+ from effectful .handlers .llm .encoding import Encodable , SynthesizedFunction
2830from effectful .handlers .llm .evaluation import UnsafeEvalProvider
29- from effectful .handlers .llm .synthesis import ProgramSynthesis , SynthesisError
3031from effectful .ops .semantics import fwd , handler
3132from effectful .ops .syntax import ObjectInterpretation , implements
3233from effectful .ops .types import NotHandled
@@ -241,29 +242,6 @@ def test_with_config_params(self, request):
241242 assert isinstance (result , str )
242243
243244
244- @pytest .mark .xfail (reason = "Program synthesis not implemented" )
245- class TestProgramSynthesis :
246- """Tests for ProgramSynthesis handler functionality."""
247-
248- @pytest .mark .xfail
249- @requires_openai
250- @retry_on_error (error = SynthesisError , n = 3 )
251- def test_generates_callable (self , request ):
252- """Test ProgramSynthesis handler generates executable code."""
253- with (
254- handler (ReplayLiteLLMProvider (request , model = "gpt-4o-mini" )),
255- handler (ProgramSynthesis ()),
256- handler (LimitLLMCallsHandler (max_calls = 1 )),
257- ):
258- count_func = create_function ("a" )
259-
260- assert callable (count_func )
261- # Test the generated function
262- assert count_func ("banana" ) == 3
263- assert count_func ("cherry" ) == 0
264- assert count_func ("aardvark" ) == 3
265-
266-
267245def smiley_face () -> Image .Image :
268246 bmp = [
269247 "00000000" ,
@@ -473,7 +451,6 @@ def test_synthesize_counter_with_parameter(self, request):
473451 @requires_openai
474452 def test_callable_type_signature_in_schema (self , request ):
475453 """Test that the callable type signature is communicated to the LLM."""
476- from effectful .handlers .llm .encoding import Encodable
477454
478455 # Verify that the enc type includes the signature in its docstring
479456 encodable = Encodable .define (Callable [[int , int ], int ], {})
@@ -487,8 +464,6 @@ def test_callable_type_signature_in_schema(self, request):
487464 @requires_openai
488465 def test_synthesized_function_roundtrip (self , request ):
489466 """Test that a synthesized function can be encoded and decoded."""
490- from effectful .handlers .llm .encoding import Encodable
491- from effectful .handlers .llm .synthesis import SynthesizedFunction
492467
493468 with (
494469 handler (ReplayLiteLLMProvider (request , model = "gpt-4o-mini" )),
@@ -513,7 +488,6 @@ def test_synthesized_function_roundtrip(self, request):
513488 @requires_openai
514489 def test_synthesize_bool_return_type (self , request ):
515490 """Test that LLM respects bool return type in signature."""
516- import inspect
517491
518492 with (
519493 handler (ReplayLiteLLMProvider (request , model = "gpt-4o-mini" )),
@@ -536,7 +510,6 @@ def test_synthesize_bool_return_type(self, request):
536510 @requires_openai
537511 def test_synthesize_three_params (self , request ):
538512 """Test that LLM respects the exact number of parameters in signature."""
539- import inspect
540513
541514 with (
542515 handler (ReplayLiteLLMProvider (request , model = "gpt-4o-mini" )),
0 commit comments