Skip to content

Invalid schema error with complex types #946

@oohmygaud

Description

@oohmygaud

First check

  • I added a descriptive title to this issue.
  • I used the GitHub search to try to find a similar issue and didn't find one.
  • I searched the Marvin documentation for this issue.

Bug summary

I encountered an error while working with complex types - it seems that using nested types with lists will break the schema. Including the ComplexType causes an error response "Invalid schema for function".

Reproduction

from pydantic import BaseModel
from typing import List

class SimpleType(BaseModel):
    name: str
    value: str

class ComplexType(BaseModel):
    name: str
    value: List[SimpleType]

class MarvinParseResult(BaseModel):
    simple_type: SimpleType
    complex_type: ComplexType # Comment this out and it passes

Error

'Error code: 400 - {\'error\': {\'message\': "Invalid schema for function \'FormatResponse\'. Please ensure it is a valid JSON Schema.", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.parameters\', \'code\': \'invalid_function_parameters\'}}

Versions

Version:		2.3.3
Python version:		3.10.12
OS/Arch:		linux/x86_64

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions