Structured Outputs Error -- allOf error

Hello,

Does anyone know why this wouldn’t work with Structured Outputs – not sure based on the documentation.

class GeneName(BaseModel):
    symbol_gene_name: str = Field(description="The short abbreviation name of the gene name not the short form") 
    long_gene_name: str = Field(description="The long form of the gene name without any abbreviations")  

class TherapeuticOpportunity(BaseModel):
    therapeutic_opportunity: list[GeneName] = Field(description="The a gene that may be associated with with {target} that prevents the disease associated with {target}")

class ClaimTopic(BaseModel):
    topic: TherapeuticOpportunity

class ClaimStructure(BaseModel):
    gene : list[GeneName] = Field(description="The gene or genes that are associated with the claim")
    topic: ClaimTopic = Field(description="The claim topic associated with the claim")
    claim: str
    evidence: str
    url_evidence: str
    null_hypothesis: str
    supportive_hypothesis: str

class ContentClaims(BaseModel):
    content_claims: list[ClaimStructure]

removing this allows it to function - not sure why.
#topic: ClaimTopic = Field(description=“The claim topic associated with the claim”)

solved my own problem - for anyone that cares - issue was multiple Fields.

from pydantic import BaseModel, Field
from typing import List

class GeneName(BaseModel):
symbol_gene_name: str = Field(description=“The short abbreviation name of the gene name, not the short form”)
long_gene_name: str = Field(description=“The long form of the gene name without any abbreviations”)

class TherapeuticOpportunity(BaseModel):
therapeutic_opportunity: List[GeneName] = Field(description=“A gene that may be associated with a target that prevents the disease associated with it”)

class ClaimTopic(BaseModel):
topic: TherapeuticOpportunity

class ClaimStructure(BaseModel):
gene: List[GeneName] = Field(description=“The gene or genes that are associated with the claim”)
topic: ClaimTopic
claim: str
evidence: str
url_evidence: str
null_hypothesis: str
supportive_hypothesis: str

class ContentClaims(BaseModel):
content_claims: List[ClaimStructure]

– works.

3 Likes