On master:
"""Reproduce: dataclass with tuple field produces prefixItems schema that OpenAI rejects."""
import litellm
from dataclasses import dataclass
from effectful.handlers.llm.encoding import Encodable
from effectful.handlers.llm.completions import Template, LiteLLMProvider
from effectful.ops.types import NotHandled
from effectful.ops.semantics import handler
@dataclass
class Point:
coords: tuple[int, int]
label: str
@Template.define
def return_point_coord() -> Point:
"""Return a Point with coords (3, 4) and label "test"."""
raise NotHandled
with handler(LiteLLMProvider(model="gpt-4o-mini")):
result = return_point_coord()
print(f"Result: {result}")
This gives error:
litellm.llms.openai.common_utils.OpenAIError: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'Response_Point': In context=('properties', 'coords'), array schema missing items.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
We already have this test but it was never ran in CI. (#619 ).
On master:
This gives error:
We already have this test but it was never ran in CI. (#619 ).