Fix vertex iteration bug and add component metadata
This commit is contained in:
parent
4916f7f050
commit
4d45f47698
6 changed files with 15 additions and 5 deletions
|
|
@ -171,8 +171,7 @@ class Graph:
|
||||||
raise ValueError(f"Error running graph: {exc}") from exc
|
raise ValueError(f"Error running graph: {exc}") from exc
|
||||||
# Get the outputs
|
# Get the outputs
|
||||||
vertex_outputs = []
|
vertex_outputs = []
|
||||||
for vertex_id in self.vertices:
|
for vertex in self.vertices:
|
||||||
vertex = self.get_vertex(vertex_id)
|
|
||||||
if vertex is None:
|
if vertex is None:
|
||||||
raise ValueError(f"Vertex {vertex_id} not found")
|
raise ValueError(f"Vertex {vertex_id} not found")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ class ResultData(BaseModel):
|
||||||
messages: Optional[list[ChatOutputResponse]] = Field(default_factory=list)
|
messages: Optional[list[ChatOutputResponse]] = Field(default_factory=list)
|
||||||
timedelta: Optional[float] = None
|
timedelta: Optional[float] = None
|
||||||
duration: Optional[str] = None
|
duration: Optional[str] = None
|
||||||
|
component_display_name: Optional[str] = None
|
||||||
|
component_id: Optional[str] = None
|
||||||
|
|
||||||
@field_serializer("results")
|
@field_serializer("results")
|
||||||
def serialize_results(self, value):
|
def serialize_results(self, value):
|
||||||
|
|
|
||||||
|
|
@ -428,6 +428,8 @@ class Vertex:
|
||||||
results=result_dict,
|
results=result_dict,
|
||||||
artifacts=artifacts,
|
artifacts=artifacts,
|
||||||
messages=messages,
|
messages=messages,
|
||||||
|
component_display_name=self.display_name,
|
||||||
|
component_id=self.id,
|
||||||
)
|
)
|
||||||
self.set_result(result_dict)
|
self.set_result(result_dict)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,9 @@ def process_tweaks(graph_data: Dict[str, Any], tweaks: Union["Tweaks", Dict[str,
|
||||||
|
|
||||||
:raises ValueError: If the input is not in the expected format.
|
:raises ValueError: If the input is not in the expected format.
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(tweaks, dict):
|
||||||
|
tweaks = tweaks.model_dump()
|
||||||
|
|
||||||
nodes = validate_input(graph_data, tweaks)
|
nodes = validate_input(graph_data, tweaks)
|
||||||
nodes_map = {node.get("id"): node for node in nodes}
|
nodes_map = {node.get("id"): node for node in nodes}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,11 @@ export default function GenericNode({
|
||||||
// This one should run only once
|
// This one should run only once
|
||||||
// first check if data.type in NATIVE_CATEGORIES
|
// first check if data.type in NATIVE_CATEGORIES
|
||||||
// if not return
|
// if not return
|
||||||
if (!NATIVE_CATEGORIES.includes(types[data.type]) || !data.node?.template?.code?.value) return;
|
if (
|
||||||
|
!NATIVE_CATEGORIES.includes(types[data.type]) ||
|
||||||
|
!data.node?.template?.code?.value
|
||||||
|
)
|
||||||
|
return;
|
||||||
const thisNodeTemplate = templates[data.type].template;
|
const thisNodeTemplate = templates[data.type].template;
|
||||||
// if the template does not have a code key
|
// if the template does not have a code key
|
||||||
// return
|
// return
|
||||||
|
|
@ -110,7 +114,7 @@ export default function GenericNode({
|
||||||
|
|
||||||
updateNodeInternals(data.id);
|
updateNodeInternals(data.id);
|
||||||
},
|
},
|
||||||
[data.id, data.node, setNode,setIsOutdated]
|
[data.id, data.node, setNode, setIsOutdated]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!data.node!.template) {
|
if (!data.node!.template) {
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ export function getCurlCode(
|
||||||
-H 'Content-Type: application/json'\\${
|
-H 'Content-Type: application/json'\\${
|
||||||
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : ""
|
!isAuth ? `\n -H 'x-api-key: <your api key>'\\` : ""
|
||||||
}
|
}
|
||||||
-d '{"inputs": ${inputs}, "tweaks": ${
|
-d '{"inputs": [${inputs}], "tweaks": ${
|
||||||
tweak && tweak.length > 0
|
tweak && tweak.length > 0
|
||||||
? buildTweakObject(tweak)
|
? buildTweakObject(tweak)
|
||||||
: JSON.stringify(tweaks, null, 2)
|
: JSON.stringify(tweaks, null, 2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue