You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The _Graph pydantic model generated from create_simple_model (which LLMGraphTransformer uses when allowed nodes and relationships are provided) does not constrain the relationships (source and target types, relationship type), and the node and relationship properties with enums when using ChatOpenAI.
One can see this by outputting the json schema from the _Graph schema and seeing enum missing from all but SimpleNode.type.
The issue is that when calling optional_enum_field throughout create_simple_model the llm_type parameter is not passed in except for when creating node type. Passing it into each call fixes the issue.
{
"title": "DynamicGraph",
"description": "Represents a graph document consisting of nodes and relationships.",
"type": "object",
"properties": {
"nodes": {
"title": "Nodes",
"description": "List of nodes",
"type": "array",
"items": {
"$ref": "#/definitions/SimpleNode"
}
},
"relationships": {
"title": "Relationships",
"description": "List of relationships",
"type": "array",
"items": {
"$ref": "#/definitions/SimpleRelationship"
}
}
},
"definitions": {
"SimpleNode": {
"title": "SimpleNode",
"type": "object",
"properties": {
"id": {
"title": "Id",
"description": "Name or human-readable unique identifier.",
"type": "string"
},
"type": {
"title": "Type",
"description": "The type or label of the node.. Available options are ['Person', 'Organization']",
"enum": [
"Person",
"Organization"
],
"type": "string"
}
},
"required": [
"id",
"type"
]
},
"SimpleRelationship": {
"title": "SimpleRelationship",
"type": "object",
"properties": {
"source_node_id": {
"title": "Source Node Id",
"description": "Name or human-readable unique identifier of source node",
"type": "string"
},
"source_node_type": {
"title": "Source Node Type",
"description": "The type or label of the source node.. Available options are ['Person', 'Organization']",
"type": "string"
},
"target_node_id": {
"title": "Target Node Id",
"description": "Name or human-readable unique identifier of target node",
"type": "string"
},
"target_node_type": {
"title": "Target Node Type",
"description": "The type or label of the target node.. Available options are ['Person', 'Organization']",
"type": "string"
},
"type": {
"title": "Type",
"description": "The type of the relationship.. Available options are ['KNOWS', 'EMPLOYED_BY']",
"type": "string"
}
},
"required": [
"source_node_id",
"source_node_type",
"target_node_id",
"target_node_type",
"type"
]
}
}
}
The text was updated successfully, but these errors were encountered:
dosubotbot
added
🔌: openai
Primarily related to OpenAI integrations
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
labels
Jul 24, 2024
#24643)
issue: #24615
descriptions: The _Graph pydantic model generated from
create_simple_model (which LLMGraphTransformer uses when allowed nodes
and relationships are provided) does not constrain the relationships
(source and target types, relationship type), and the node and
relationship properties with enums when using ChatOpenAI.
The issue is that when calling optional_enum_field throughout
create_simple_model the llm_type parameter is not passed in except for
when creating node type. Passing it into each call fixes the issue.
Co-authored-by: Lifu Wu <lifu@nextbillion.ai>
olgamurraft
pushed a commit
to olgamurraft/langchain
that referenced
this issue
Aug 16, 2024
langchain-ai#24643)
issue: langchain-ai#24615
descriptions: The _Graph pydantic model generated from
create_simple_model (which LLMGraphTransformer uses when allowed nodes
and relationships are provided) does not constrain the relationships
(source and target types, relationship type), and the node and
relationship properties with enums when using ChatOpenAI.
The issue is that when calling optional_enum_field throughout
create_simple_model the llm_type parameter is not passed in except for
when creating node type. Passing it into each call fixes the issue.
Co-authored-by: Lifu Wu <lifu@nextbillion.ai>
dosubotbot
added
the
stale
Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
label
Oct 23, 2024
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
The
_Graph
pydantic model generated fromcreate_simple_model
(whichLLMGraphTransformer
uses when allowed nodes and relationships are provided) does not constrain the relationships (source and target types, relationship type), and the node and relationship properties with enums when using ChatOpenAI.One can see this by outputting the json schema from the
_Graph
schema and seeingenum
missing from all butSimpleNode.type
.The issue is that when calling
optional_enum_field
throughoutcreate_simple_model
thellm_type
parameter is not passed in except for when creating node type. Passing it into each call fixes the issue.System Info
platform: wsl2 windows
Python 3.10.14
The text was updated successfully, but these errors were encountered: