Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Adds parent pointer storage + fork display in the UI

elijahbenizzyc4cf84bae46d
diff --git a/burr/common/__init__.py b/burr/common/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/burr/common/types.py b/burr/common/types.py
new file mode 100644
index 00000000..326738c9
--- /dev/null
+++ b/burr/common/types.py
@@ -0,0 +1,9 @@
+import dataclasses
+from typing import Optional
+
+
+class ParentPointer:
+ app_id: str
+ partition_key: Optional[str]
+ sequence_id: Optional[int]
diff --git a/burr/core/application.py b/burr/core/application.py
index 561df5bc..16c8817f 100644
--- a/burr/core/application.py
+++ b/burr/core/application.py
@@ -21,6 +21,7 @@ from typing import (
)
from burr import telemetry, visibility
+from burr.common import types as burr_types
from burr.core import persistence
from burr.core.action import (
Action,
@@ -284,6 +285,7 @@ class Application:
sequence_id: Optional[int] = None,
adapter_set: Optional[LifecycleAdapterSet] = None,
builder: Optional["ApplicationBuilder"] = None,
+ parent_pointer: Optional[burr_types.ParentPointer] = None,
):
"""Instantiates an Application. This is an internal API -- use the builder!
@@ -314,6 +316,7 @@ class Application:
application_graph=self._graph,
app_id=self._uid,
partition_key=self._partition_key,
+ parent_pointer=parent_pointer,
)
# TODO -- consider adding global inputs + global input factories to the builder
self.dependency_factory = {
@@ -324,6 +327,7 @@ class Application:
if sequence_id is not None:
self._set_sequence_id(sequence_id)
self._builder = builder
+ self._parent_pointer = parent_pointer
# @telemetry.capture_function_usage # todo -- capture usage when we break this up into one that isn't called internally
# This will be doable when we move sequence ID to the beginning of the function https://github.com/DAGWorks-Inc/burr/pull/73
@@ -1064,6 +1068,15 @@ class Application:
"""
return self._state
+ @property
+ def parent_pointer(self) -> Optional[burr_types.ParentPointer]:
+ """Gives the parent pointer of an application (from where it was forked).
+ This is None if it was not forked.
+
+ :return: The parent pointer object.
+ """
+ return self._parent_pointer
+
def _create_graph(self) -> ApplicationGraph:
"""Internal-facing utility function for creating an ApplicationGraph"""
all_actions = {action.name: action for action in self._actions}
@@ -1207,6 +1220,7 @@ class ApplicationBuilder:
self.fork_from_app_id: Optional[str] = None
self.fork_from_partition_key: Optional[str] = None
self.fork_from_sequence_id: Optional[int] = None
+ self.loaded_from_fork: bool = False
def with_identifiers(
self, app_id: str = None, partition_key: str = None, sequence_id: int = None
@@ -1492,6 +1506,7 @@ class ApplicationBuilder:
self.state = self.state.update(**self.default_state)
self.sequence_id = None # has to start at None
else:
+ self.loaded_from_fork = True
if load_result["state"] is None:
raise ValueError(
ERROR_MESSAGE
@@ -1560,4 +1575,11 @@ class ApplicationBuilder:
sequence_id=self.sequence_id,
adapter_set=LifecycleAdapterSet(*self.lifecycle_adapters),
builder=self,
+ parent_pointer=burr_types.ParentPointer(
+ app_id=self.fork_from_app_id,
+ partition_key=self.fork_from_partition_key,
+ sequence_id=self.fork_from_sequence_id,
+ )
+ if self.loaded_from_fork
+ else None,
)
diff --git a/burr/lifecycle/base.py b/burr/lifecycle/base.py
index 30508011..e1b59826 100644
--- a/burr/lifecycle/base.py
+++ b/burr/lifecycle/base.py
@@ -1,6 +1,8 @@
import abc
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
+import burr.common.types as burr_types
+
if TYPE_CHECKING:
# type-checking-only for a circular import
from burr.core import State, Action, ApplicationGraph
@@ -134,6 +136,7 @@ class PostApplicationCreateHook(abc.ABC):
partition_key: Optional[str],
state: "State",
application_graph: "ApplicationGraph",
+ parent_pointer: burr_types.ParentPointer,
**future_kwargs: Any,
):
"""Runs after an "application" object is instantiated. This is run by the Application, in its constructor,
@@ -143,6 +146,7 @@ class PostApplicationCreateHook(abc.ABC):
:param partition_key: Partition key of application
:param state: Current state of the application
:param application_graph: Application graph of the application, representing the state machine
+ :param parent_pointer: Parent pointer of the application
:param future_kwargs: Future keyword arguments for backwards compatibility
"""
pass
diff --git a/burr/tracking/client.py b/burr/tracking/client.py
index 9ff3dfbd..e5d38f6d 100644
--- a/burr/tracking/client.py
+++ b/burr/tracking/client.py
@@ -7,6 +7,7 @@ import traceback
from typing import Any, Dict, Optional
from burr import system
+from burr.common import types as burr_types
from burr.core import Action, ApplicationGraph, State
from burr.core.persistence import BaseStateLoader, PersistedStateData
from burr.integrations.base import require_plugin
@@ -24,6 +25,7 @@ from burr.tracking.common.models import (
BeginSpanModel,
EndEntryModel,
EndSpanModel,
+ PointerModel,
)
from burr.visibility import ActionSpan
@@ -203,6 +205,7 @@ class LocalTrackingClient(
partition_key: Optional[str],
state: "State",
application_graph: "ApplicationGraph",
+ parent_pointer: Optional[burr_types.ParentPointer],
**future_kwargs: Any,
):
self._ensure_dir_structure(app_id)
@@ -211,7 +214,9 @@ class LocalTrackingClient(
if os.path.exists(graph_path):
logger.info(f"Graph already exists at {graph_path}. Not overwriting.")
return
- graph = ApplicationModel.from_application_graph(application_graph).model_dump()
+ graph = ApplicationModel.from_application_graph(
+ application_graph,
+ ).model_dump()
with open(graph_path, "w") as f:
json.dump(graph, f)
@@ -221,6 +226,9 @@ class LocalTrackingClient(
return
metadata = ApplicationMetadataModel(
partition_key=partition_key,
+ parent_pointer=PointerModel.from_pointer(parent_pointer)
+ if parent_pointer is not None
+ else None,
).model_dump()
with open(metadata_path, "w") as f:
json.dump(metadata, f)
diff --git a/burr/tracking/common/models.py b/burr/tracking/common/models.py
index 26c7f27c..ebbe54a6 100644
--- a/burr/tracking/common/models.py
+++ b/burr/tracking/common/models.py
@@ -4,6 +4,7 @@ from typing import Any, Dict, List, Optional, Union
from pydantic import field_serializer
+from burr.common import types as burr_types
from burr.core import Action
from burr.core.action import FunctionBasedAction, FunctionBasedStreamingAction
from burr.core.application import ApplicationGraph, Transition
@@ -81,6 +82,21 @@ class TransitionModel(IdentifyingModel):
)
+class PointerModel(IdentifyingModel):
+ app_id: str
+ sequence_id: Optional[int]
+ partition_key: Optional[str]
+ type: str = "pointer_data"
+
+ @staticmethod
+ def from_pointer(pointer: burr_types.ParentPointer) -> "PointerModel":
+ return PointerModel(
+ app_id=pointer.app_id,
+ sequence_id=pointer.sequence_id,
+ partition_key=pointer.partition_key,
+ )
+
+
class ApplicationModel(IdentifyingModel):
"""Pydantic model that represents an application for storing/visualization in the UI"""
@@ -90,7 +106,9 @@ class ApplicationModel(IdentifyingModel):
type: str = "application"
@staticmethod
- def from_application_graph(application_graph: ApplicationGraph) -> "ApplicationModel":
+ def from_application_graph(
+ application_graph: ApplicationGraph,
+ ) -> "ApplicationModel":
return ApplicationModel(
entrypoint=application_graph.entrypoint.name,
actions=[ActionModel.from_action(action) for action in application_graph.actions],
@@ -105,7 +123,8 @@ class ApplicationMetadataModel(IdentifyingModel):
"""Pydantic model that represents metadata for an application.
We will want to add tags here when we have them."""
- partition_key: Optional[str]
+ partition_key: Optional[str] = None
+ parent_pointer: Optional[PointerModel] = None # pointer to parent data
type: str = "application_metadata"
diff --git a/burr/tracking/server/backend.py b/burr/tracking/server/backend.py
index 40d5ae62..195393ba 100644
--- a/burr/tracking/server/backend.py
+++ b/burr/tracking/server/backend.py
@@ -109,6 +109,12 @@ class LocalBackend(BackendBase):
return line_data["sequence_id"] + 1
return count
+ async def _load_metadata(self, metadata_path: str) -> models.ApplicationMetadataModel:
+ if os.path.exists(metadata_path):
+ async with aiofiles.open(metadata_path) as f:
+ return models.ApplicationMetadataModel.parse_obj(json.loads(await f.read()))
+ return models.ApplicationMetadataModel()
+
async def list_apps(
self, request: fastapi.Request, project_id: str
) -> Sequence[ApplicationSummary]:
@@ -125,13 +131,7 @@ class LocalBackend(BackendBase):
metadata_path = os.path.join(full_path, "metadata.json")
log_path = os.path.join(full_path, "log.jsonl")
if os.path.isdir(full_path):
- if os.path.exists(metadata_path):
- async with aiofiles.open(metadata_path) as f:
- metadata = models.ApplicationMetadataModel.parse_obj(
- json.loads(await f.read())
- )
- else:
- metadata = models.ApplicationMetadataModel() # backwards compatibility
+ metadata = await self._load_metadata(metadata_path)
out.append(
schema.ApplicationSummary(
app_id=entry,
@@ -140,6 +140,7 @@ class LocalBackend(BackendBase):
last_written=await aiofilesos.path.getmtime(full_path),
num_steps=await self.get_number_of_steps(log_path),
tags={},
+ parent_pointer=metadata.parent_pointer,
)
)
return out
@@ -154,6 +155,8 @@ class LocalBackend(BackendBase):
)
log_file = os.path.join(app_filepath, "log.jsonl")
graph_file = os.path.join(app_filepath, "graph.json")
+ metadata_file = os.path.join(app_filepath, "metadata.json")
+ metadata = await self._load_metadata(metadata_file)
if not os.path.exists(graph_file):
raise fastapi.HTTPException(
status_code=404,
@@ -194,4 +197,5 @@ class LocalBackend(BackendBase):
return ApplicationLogs(
application=schema.ApplicationModel.parse_raw(str_graph),
steps=list(steps_by_sequence_id.values()),
+ parent_pointer=metadata.parent_pointer,
)
diff --git a/burr/tracking/server/schema.py b/burr/tracking/server/schema.py
index af13b6bb..8c6780bf 100644
--- a/burr/tracking/server/schema.py
+++ b/burr/tracking/server/schema.py
@@ -9,6 +9,7 @@ from burr.tracking.common.models import (
BeginSpanModel,
EndEntryModel,
EndSpanModel,
+ PointerModel,
)
@@ -28,6 +29,7 @@ class ApplicationSummary(pydantic.BaseModel):
last_written: datetime.datetime
num_steps: int
tags: Dict[str, str]
+ parent_pointer: Optional[PointerModel] = None
class Span(pydantic.BaseModel):
@@ -52,3 +54,4 @@ class ApplicationLogs(pydantic.BaseModel):
application: ApplicationModel
steps: List[Step]
+ parent_pointer: Optional[PointerModel] = None
diff --git a/examples/conversational-rag/notebook.ipynb b/examples/conversational-rag/notebook.ipynb
index 5a9c9099..e0192b19 100644
--- a/examples/conversational-rag/notebook.ipynb
+++ b/examples/conversational-rag/notebook.ipynb
@@ -87,173 +87,173 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
- "<!-- Generated by graphviz version 10.0.1 (20240210.2158)\n",
+ "<!-- Generated by graphviz version 8.1.0 (20230707.0739)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
- "<svg width=\"1051pt\" height=\"343pt\"\n",
- " viewBox=\"0.00 0.00 1050.60 342.80\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
- "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 338.8)\">\n",
- "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-338.8 1046.6,-338.8 1046.6,4 -4,4\"/>\n",
+ "<svg width=\"1051pt\" height=\"352pt\"\n",
+ " viewBox=\"0.00 0.00 1050.60 352.30\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
+ "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 348.3)\">\n",
+ "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-348.3 1046.6,-348.3 1046.6,4 -4,4\"/>\n",
"<g id=\"clust1\" class=\"cluster\">\n",
"<title>cluster__legend</title>\n",
- "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"19.38,-196.8 19.38,-326.8 104.23,-326.8 104.23,-196.8 19.38,-196.8\"/>\n",
- "<text text-anchor=\"middle\" x=\"61.8\" y=\"-309.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
- "</g>\n",
- "<!-- vector_store -->\n",
- "<g id=\"node1\" class=\"node\">\n",
- "<title>vector_store</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M533.05,-63.6C533.05,-63.6 409.45,-63.6 409.45,-63.6 403.45,-63.6 397.45,-57.6 397.45,-51.6 397.45,-51.6 397.45,-12 397.45,-12 397.45,-6 403.45,0 409.45,0 409.45,0 533.05,0 533.05,0 539.05,0 545.05,-6 545.05,-12 545.05,-12 545.05,-51.6 545.05,-51.6 545.05,-57.6 539.05,-63.6 533.05,-63.6\"/>\n",
- "<text text-anchor=\"start\" x=\"430.75\" y=\"-40.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">vector_store</text>\n",
- "<text text-anchor=\"start\" x=\"408.25\" y=\"-12.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">VectorStoreRetriever</text>\n",
+ "<polygon fill=\"#ffffff\" stroke=\"black\" points=\"19.38,-206.3 19.38,-336.3 104.23,-336.3 104.23,-206.3 19.38,-206.3\"/>\n",
+ "<text text-anchor=\"middle\" x=\"61.8\" y=\"-319\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">Legend</text>\n",
"</g>\n",
"<!-- context -->\n",
- "<g id=\"node2\" class=\"node\">\n",
+ "<g id=\"node1\" class=\"node\">\n",
"<title>context</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M636.15,-141.6C636.15,-141.6 590.55,-141.6 590.55,-141.6 584.55,-141.6 578.55,-135.6 578.55,-129.6 578.55,-129.6 578.55,-90 578.55,-90 578.55,-84 584.55,-78 590.55,-78 590.55,-78 636.15,-78 636.15,-78 642.15,-78 648.15,-84 648.15,-90 648.15,-90 648.15,-129.6 648.15,-129.6 648.15,-135.6 642.15,-141.6 636.15,-141.6\"/>\n",
- "<text text-anchor=\"start\" x=\"589.35\" y=\"-118.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">context</text>\n",
- "<text text-anchor=\"start\" x=\"605.85\" y=\"-90.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
- "</g>\n",
- "<!-- vector_store&#45;&gt;context -->\n",
- "<g id=\"edge3\" class=\"edge\">\n",
- "<title>vector_store&#45;&gt;context</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M533.57,-64C538.99,-66.94 544.38,-69.91 549.55,-72.8 555.71,-76.25 562.17,-79.95 568.5,-83.63\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"566.58,-86.56 576.98,-88.59 570.12,-80.52 566.58,-86.56\"/>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M636.15,-137.1C636.15,-137.1 590.55,-137.1 590.55,-137.1 584.55,-137.1 578.55,-131.1 578.55,-125.1 578.55,-125.1 578.55,-85.5 578.55,-85.5 578.55,-79.5 584.55,-73.5 590.55,-73.5 590.55,-73.5 636.15,-73.5 636.15,-73.5 642.15,-73.5 648.15,-79.5 648.15,-85.5 648.15,-85.5 648.15,-125.1 648.15,-125.1 648.15,-131.1 642.15,-137.1 636.15,-137.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"589.35\" y=\"-114\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">context</text>\n",
+ "<text text-anchor=\"start\" x=\"605.85\" y=\"-86\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
"</g>\n",
"<!-- answer_prompt -->\n",
- "<g id=\"node6\" class=\"node\">\n",
+ "<g id=\"node5\" class=\"node\">\n",
"<title>answer_prompt</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M788.75,-207.6C788.75,-207.6 689.15,-207.6 689.15,-207.6 683.15,-207.6 677.15,-201.6 677.15,-195.6 677.15,-195.6 677.15,-156 677.15,-156 677.15,-150 683.15,-144 689.15,-144 689.15,-144 788.75,-144 788.75,-144 794.75,-144 800.75,-150 800.75,-156 800.75,-156 800.75,-195.6 800.75,-195.6 800.75,-201.6 794.75,-207.6 788.75,-207.6\"/>\n",
- "<text text-anchor=\"start\" x=\"687.95\" y=\"-184.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">answer_prompt</text>\n",
- "<text text-anchor=\"start\" x=\"731.45\" y=\"-156.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M788.75,-208.1C788.75,-208.1 689.15,-208.1 689.15,-208.1 683.15,-208.1 677.15,-202.1 677.15,-196.1 677.15,-196.1 677.15,-156.5 677.15,-156.5 677.15,-150.5 683.15,-144.5 689.15,-144.5 689.15,-144.5 788.75,-144.5 788.75,-144.5 794.75,-144.5 800.75,-150.5 800.75,-156.5 800.75,-156.5 800.75,-196.1 800.75,-196.1 800.75,-202.1 794.75,-208.1 788.75,-208.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"687.95\" y=\"-185\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">answer_prompt</text>\n",
+ "<text text-anchor=\"start\" x=\"731.45\" y=\"-157\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
"</g>\n",
"<!-- context&#45;&gt;answer_prompt -->\n",
- "<g id=\"edge10\" class=\"edge\">\n",
+ "<g id=\"edge8\" class=\"edge\">\n",
"<title>context&#45;&gt;answer_prompt</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M648.45,-128.01C654.6,-131.29 661.2,-134.82 667.94,-138.42\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"666.06,-141.38 676.53,-143.01 669.36,-135.21 666.06,-141.38\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M648.45,-124.89C656.03,-129.24 664.31,-134 672.68,-138.81\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"670.71,-142.29 681.13,-144.23 674.2,-136.22 670.71,-142.29\"/>\n",
"</g>\n",
"<!-- conversational_rag_response -->\n",
- "<g id=\"node3\" class=\"node\">\n",
+ "<g id=\"node2\" class=\"node\">\n",
"<title>conversational_rag_response</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1030.6,-237.6C1030.6,-237.6 841.75,-237.6 841.75,-237.6 835.75,-237.6 829.75,-231.6 829.75,-225.6 829.75,-225.6 829.75,-186 829.75,-186 829.75,-180 835.75,-174 841.75,-174 841.75,-174 1030.6,-174 1030.6,-174 1036.6,-174 1042.6,-180 1042.6,-186 1042.6,-186 1042.6,-225.6 1042.6,-225.6 1042.6,-231.6 1036.6,-237.6 1030.6,-237.6\"/>\n",
- "<text text-anchor=\"start\" x=\"840.55\" y=\"-214.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">conversational_rag_response</text>\n",
- "<text text-anchor=\"start\" x=\"928.68\" y=\"-186.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
- "</g>\n",
- "<!-- standalone_question -->\n",
- "<g id=\"node4\" class=\"node\">\n",
- "<title>standalone_question</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M537.55,-207.6C537.55,-207.6 404.95,-207.6 404.95,-207.6 398.95,-207.6 392.95,-201.6 392.95,-195.6 392.95,-195.6 392.95,-156 392.95,-156 392.95,-150 398.95,-144 404.95,-144 404.95,-144 537.55,-144 537.55,-144 543.55,-144 549.55,-150 549.55,-156 549.55,-156 549.55,-195.6 549.55,-195.6 549.55,-201.6 543.55,-207.6 537.55,-207.6\"/>\n",
- "<text text-anchor=\"start\" x=\"403.75\" y=\"-184.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">standalone_question</text>\n",
- "<text text-anchor=\"start\" x=\"463.75\" y=\"-156.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
- "</g>\n",
- "<!-- standalone_question&#45;&gt;context -->\n",
- "<g id=\"edge2\" class=\"edge\">\n",
- "<title>standalone_question&#45;&gt;context</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M540.66,-143.57C549.94,-139.2 559.26,-134.81 567.97,-130.71\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"569.32,-133.94 576.88,-126.51 566.34,-127.61 569.32,-133.94\"/>\n",
- "</g>\n",
- "<!-- standalone_question&#45;&gt;answer_prompt -->\n",
- "<g id=\"edge11\" class=\"edge\">\n",
- "<title>standalone_question&#45;&gt;answer_prompt</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M549.82,-175.8C586.3,-175.8 629.57,-175.8 665.4,-175.8\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"665.24,-179.3 675.24,-175.8 665.24,-172.3 665.24,-179.3\"/>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M1030.6,-238.1C1030.6,-238.1 841.75,-238.1 841.75,-238.1 835.75,-238.1 829.75,-232.1 829.75,-226.1 829.75,-226.1 829.75,-186.5 829.75,-186.5 829.75,-180.5 835.75,-174.5 841.75,-174.5 841.75,-174.5 1030.6,-174.5 1030.6,-174.5 1036.6,-174.5 1042.6,-180.5 1042.6,-186.5 1042.6,-186.5 1042.6,-226.1 1042.6,-226.1 1042.6,-232.1 1036.6,-238.1 1030.6,-238.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"840.55\" y=\"-215\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">conversational_rag_response</text>\n",
+ "<text text-anchor=\"start\" x=\"928.68\" y=\"-187\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
"</g>\n",
"<!-- standalone_question_prompt -->\n",
- "<g id=\"node5\" class=\"node\">\n",
+ "<g id=\"node3\" class=\"node\">\n",
"<title>standalone_question_prompt</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M351.95,-185.6C351.95,-185.6 164.6,-185.6 164.6,-185.6 158.6,-185.6 152.6,-179.6 152.6,-173.6 152.6,-173.6 152.6,-134 152.6,-134 152.6,-128 158.6,-122 164.6,-122 164.6,-122 351.95,-122 351.95,-122 357.95,-122 363.95,-128 363.95,-134 363.95,-134 363.95,-173.6 363.95,-173.6 363.95,-179.6 357.95,-185.6 351.95,-185.6\"/>\n",
- "<text text-anchor=\"start\" x=\"163.4\" y=\"-162.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">standalone_question_prompt</text>\n",
- "<text text-anchor=\"start\" x=\"250.78\" y=\"-134.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M351.95,-195.1C351.95,-195.1 164.6,-195.1 164.6,-195.1 158.6,-195.1 152.6,-189.1 152.6,-183.1 152.6,-183.1 152.6,-143.5 152.6,-143.5 152.6,-137.5 158.6,-131.5 164.6,-131.5 164.6,-131.5 351.95,-131.5 351.95,-131.5 357.95,-131.5 363.95,-137.5 363.95,-143.5 363.95,-143.5 363.95,-183.1 363.95,-183.1 363.95,-189.1 357.95,-195.1 351.95,-195.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"163.4\" y=\"-172\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">standalone_question_prompt</text>\n",
+ "<text text-anchor=\"start\" x=\"250.78\" y=\"-144\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
+ "</g>\n",
+ "<!-- standalone_question -->\n",
+ "<g id=\"node7\" class=\"node\">\n",
+ "<title>standalone_question</title>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M537.55,-208.1C537.55,-208.1 404.95,-208.1 404.95,-208.1 398.95,-208.1 392.95,-202.1 392.95,-196.1 392.95,-196.1 392.95,-156.5 392.95,-156.5 392.95,-150.5 398.95,-144.5 404.95,-144.5 404.95,-144.5 537.55,-144.5 537.55,-144.5 543.55,-144.5 549.55,-150.5 549.55,-156.5 549.55,-156.5 549.55,-196.1 549.55,-196.1 549.55,-202.1 543.55,-208.1 537.55,-208.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"403.75\" y=\"-185\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">standalone_question</text>\n",
+ "<text text-anchor=\"start\" x=\"463.75\" y=\"-157\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">str</text>\n",
"</g>\n",
"<!-- standalone_question_prompt&#45;&gt;standalone_question -->\n",
- "<g id=\"edge7\" class=\"edge\">\n",
+ "<g id=\"edge10\" class=\"edge\">\n",
"<title>standalone_question_prompt&#45;&gt;standalone_question</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M364.14,-164.74C370.01,-165.35 375.87,-165.96 381.66,-166.56\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"380.88,-170 391.19,-167.56 381.61,-163.04 380.88,-170\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M364.14,-169.76C370.16,-170.13 376.17,-170.5 382.11,-170.87\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"381.5,-174.4 391.7,-171.52 381.93,-167.41 381.5,-174.4\"/>\n",
+ "</g>\n",
+ "<!-- vector_store -->\n",
+ "<g id=\"node4\" class=\"node\">\n",
+ "<title>vector_store</title>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M533.05,-126.1C533.05,-126.1 409.45,-126.1 409.45,-126.1 403.45,-126.1 397.45,-120.1 397.45,-114.1 397.45,-114.1 397.45,-74.5 397.45,-74.5 397.45,-68.5 403.45,-62.5 409.45,-62.5 409.45,-62.5 533.05,-62.5 533.05,-62.5 539.05,-62.5 545.05,-68.5 545.05,-74.5 545.05,-74.5 545.05,-114.1 545.05,-114.1 545.05,-120.1 539.05,-126.1 533.05,-126.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"430.75\" y=\"-103\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">vector_store</text>\n",
+ "<text text-anchor=\"start\" x=\"408.25\" y=\"-75\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">VectorStoreRetriever</text>\n",
+ "</g>\n",
+ "<!-- vector_store&#45;&gt;context -->\n",
+ "<g id=\"edge2\" class=\"edge\">\n",
+ "<title>vector_store&#45;&gt;context</title>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M545.17,-100.03C552.76,-100.62 560.31,-101.21 567.46,-101.78\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"567.06,-105.33 577.3,-102.63 567.6,-98.35 567.06,-105.33\"/>\n",
"</g>\n",
"<!-- answer_prompt&#45;&gt;conversational_rag_response -->\n",
- "<g id=\"edge5\" class=\"edge\">\n",
+ "<g id=\"edge4\" class=\"edge\">\n",
"<title>answer_prompt&#45;&gt;conversational_rag_response</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M801.18,-185.21C806.7,-186.06 812.4,-186.93 818.2,-187.82\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"817.53,-191.26 827.94,-189.32 818.59,-184.34 817.53,-191.26\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M801.18,-185.71C806.85,-186.58 812.7,-187.48 818.65,-188.39\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"818.02,-191.99 828.44,-190.05 819.09,-185.07 818.02,-191.99\"/>\n",
"</g>\n",
"<!-- llm_client -->\n",
- "<g id=\"node7\" class=\"node\">\n",
+ "<g id=\"node6\" class=\"node\">\n",
"<title>llm_client</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M288.58,-267.6C288.58,-267.6 227.98,-267.6 227.98,-267.6 221.98,-267.6 215.98,-261.6 215.98,-255.6 215.98,-255.6 215.98,-216 215.98,-216 215.98,-210 221.98,-204 227.98,-204 227.98,-204 288.58,-204 288.58,-204 294.58,-204 300.58,-210 300.58,-216 300.58,-216 300.58,-255.6 300.58,-255.6 300.58,-261.6 294.58,-267.6 288.58,-267.6\"/>\n",
- "<text text-anchor=\"start\" x=\"226.78\" y=\"-244.5\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">llm_client</text>\n",
- "<text text-anchor=\"start\" x=\"235.03\" y=\"-216.5\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">OpenAI</text>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M288.58,-277.1C288.58,-277.1 227.98,-277.1 227.98,-277.1 221.98,-277.1 215.98,-271.1 215.98,-265.1 215.98,-265.1 215.98,-225.5 215.98,-225.5 215.98,-219.5 221.98,-213.5 227.98,-213.5 227.98,-213.5 288.58,-213.5 288.58,-213.5 294.58,-213.5 300.58,-219.5 300.58,-225.5 300.58,-225.5 300.58,-265.1 300.58,-265.1 300.58,-271.1 294.58,-277.1 288.58,-277.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"226.78\" y=\"-254\" font-family=\"Helvetica,sans-Serif\" font-weight=\"bold\" font-size=\"14.00\">llm_client</text>\n",
+ "<text text-anchor=\"start\" x=\"235.03\" y=\"-226\" font-family=\"Helvetica,sans-Serif\" font-style=\"italic\" font-size=\"14.00\">OpenAI</text>\n",
"</g>\n",
"<!-- llm_client&#45;&gt;conversational_rag_response -->\n",
- "<g id=\"edge6\" class=\"edge\">\n",
+ "<g id=\"edge5\" class=\"edge\">\n",
"<title>llm_client&#45;&gt;conversational_rag_response</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M300.74,-235C391.46,-233.12 614.35,-227.69 800.75,-216.8 806.45,-216.47 812.28,-216.1 818.17,-215.7\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"818.3,-219.2 828.03,-215.02 817.81,-212.22 818.3,-219.2\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M300.74,-243.58C391.45,-239.73 614.31,-229.75 800.75,-217.3 806.59,-216.91 812.57,-216.49 818.61,-216.05\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"818.81,-219.47 828.53,-215.25 818.3,-212.49 818.81,-219.47\"/>\n",
"</g>\n",
"<!-- llm_client&#45;&gt;standalone_question -->\n",
- "<g id=\"edge8\" class=\"edge\">\n",
+ "<g id=\"edge11\" class=\"edge\">\n",
"<title>llm_client&#45;&gt;standalone_question</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M300.96,-223.95C324.07,-217.37 353.72,-208.94 381.74,-200.97\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"382.67,-204.35 391.33,-198.24 380.76,-197.61 382.67,-204.35\"/>\n",
- "</g>\n",
- "<!-- _vector_store_inputs -->\n",
- "<g id=\"node8\" class=\"node\">\n",
- "<title>_vector_store_inputs</title>\n",
- "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"316.95,-54.1 199.6,-54.1 199.6,-9.5 316.95,-9.5 316.95,-54.1\"/>\n",
- "<text text-anchor=\"start\" x=\"214.4\" y=\"-26\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input_texts</text>\n",
- "<text text-anchor=\"start\" x=\"285.65\" y=\"-26\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">list</text>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M300.96,-231.67C324.27,-224.04 354.25,-214.24 382.48,-205\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"383.37,-208.07 391.79,-201.63 381.2,-201.42 383.37,-208.07\"/>\n",
"</g>\n",
- "<!-- _vector_store_inputs&#45;&gt;vector_store -->\n",
+ "<!-- standalone_question&#45;&gt;context -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
- "<title>_vector_store_inputs&#45;&gt;vector_store</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M317.2,-31.8C338.28,-31.8 362.57,-31.8 385.49,-31.8\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"385.46,-35.3 395.46,-31.8 385.46,-28.3 385.46,-35.3\"/>\n",
+ "<title>standalone_question&#45;&gt;context</title>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M535.74,-144.12C546.82,-138.51 558.13,-132.78 568.53,-127.51\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"569.85,-130.25 577.19,-122.61 566.69,-124.01 569.85,-130.25\"/>\n",
+ "</g>\n",
+ "<!-- standalone_question&#45;&gt;answer_prompt -->\n",
+ "<g id=\"edge9\" class=\"edge\">\n",
+ "<title>standalone_question&#45;&gt;answer_prompt</title>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M549.82,-176.3C586.46,-176.3 629.94,-176.3 665.86,-176.3\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"665.75,-179.8 675.75,-176.3 665.75,-172.8 665.75,-179.8\"/>\n",
"</g>\n",
"<!-- _context_inputs -->\n",
- "<g id=\"node9\" class=\"node\">\n",
+ "<g id=\"node8\" class=\"node\">\n",
"<title>_context_inputs</title>\n",
- "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"512.68,-126.1 429.83,-126.1 429.83,-81.5 512.68,-81.5 512.68,-126.1\"/>\n",
- "<text text-anchor=\"start\" x=\"444.63\" y=\"-98\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">top_k</text>\n",
- "<text text-anchor=\"start\" x=\"483.63\" y=\"-98\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">int</text>\n",
+ "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"512.68,-44.6 429.83,-44.6 429.83,0 512.68,0 512.68,-44.6\"/>\n",
+ "<text text-anchor=\"start\" x=\"444.63\" y=\"-16.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">top_k</text>\n",
+ "<text text-anchor=\"start\" x=\"483.63\" y=\"-16.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">int</text>\n",
"</g>\n",
"<!-- _context_inputs&#45;&gt;context -->\n",
- "<g id=\"edge4\" class=\"edge\">\n",
+ "<g id=\"edge3\" class=\"edge\">\n",
"<title>_context_inputs&#45;&gt;context</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M513.15,-105.55C530.11,-106.28 549.85,-107.12 567.23,-107.87\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"566.6,-111.34 576.74,-108.28 566.9,-104.35 566.6,-111.34\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M513.1,-35.95C525.2,-40.71 538.24,-46.57 549.55,-53.3 556.48,-57.42 563.43,-62.28 570.06,-67.35\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"567.24,-70.37 577.25,-73.84 571.58,-64.89 567.24,-70.37\"/>\n",
"</g>\n",
"<!-- _standalone_question_prompt_inputs -->\n",
- "<g id=\"node10\" class=\"node\">\n",
+ "<g id=\"node9\" class=\"node\">\n",
"<title>_standalone_question_prompt_inputs</title>\n",
- "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"123.6,-186.6 0,-186.6 0,-121 123.6,-121 123.6,-186.6\"/>\n",
- "<text text-anchor=\"start\" x=\"25.3\" y=\"-158.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">question</text>\n",
- "<text text-anchor=\"start\" x=\"93.3\" y=\"-158.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n",
- "<text text-anchor=\"start\" x=\"14.43\" y=\"-137.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">chat_history</text>\n",
- "<text text-anchor=\"start\" x=\"92.55\" y=\"-137.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">list</text>\n",
+ "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"123.6,-196.1 0,-196.1 0,-130.5 123.6,-130.5 123.6,-196.1\"/>\n",
+ "<text text-anchor=\"start\" x=\"14.43\" y=\"-168\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">chat_history</text>\n",
+ "<text text-anchor=\"start\" x=\"92.55\" y=\"-168\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">list</text>\n",
+ "<text text-anchor=\"start\" x=\"25.3\" y=\"-147\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">question</text>\n",
+ "<text text-anchor=\"start\" x=\"93.3\" y=\"-147\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">str</text>\n",
"</g>\n",
"<!-- _standalone_question_prompt_inputs&#45;&gt;standalone_question_prompt -->\n",
- "<g id=\"edge9\" class=\"edge\">\n",
+ "<g id=\"edge6\" class=\"edge\">\n",
"<title>_standalone_question_prompt_inputs&#45;&gt;standalone_question_prompt</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M124.07,-153.8C129.56,-153.8 135.24,-153.8 141,-153.8\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"140.67,-157.3 150.67,-153.8 140.67,-150.3 140.67,-157.3\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M124.07,-163.3C129.7,-163.3 135.53,-163.3 141.45,-163.3\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"141.18,-166.8 151.18,-163.3 141.18,-159.8 141.18,-166.8\"/>\n",
+ "</g>\n",
+ "<!-- _vector_store_inputs -->\n",
+ "<g id=\"node10\" class=\"node\">\n",
+ "<title>_vector_store_inputs</title>\n",
+ "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"316.95,-113.6 199.6,-113.6 199.6,-69 316.95,-69 316.95,-113.6\"/>\n",
+ "<text text-anchor=\"start\" x=\"214.4\" y=\"-85.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input_texts</text>\n",
+ "<text text-anchor=\"start\" x=\"285.65\" y=\"-85.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">list</text>\n",
+ "</g>\n",
+ "<!-- _vector_store_inputs&#45;&gt;vector_store -->\n",
+ "<g id=\"edge7\" class=\"edge\">\n",
+ "<title>_vector_store_inputs&#45;&gt;vector_store</title>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M317.2,-92.12C338.48,-92.43 363.01,-92.78 386.12,-93.1\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"385.92,-96.62 395.97,-93.26 386.02,-89.62 385.92,-96.62\"/>\n",
"</g>\n",
"<!-- input -->\n",
"<g id=\"node11\" class=\"node\">\n",
"<title>input</title>\n",
- "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"88.8,-241.1 34.8,-241.1 34.8,-204.5 88.8,-204.5 88.8,-241.1\"/>\n",
- "<text text-anchor=\"middle\" x=\"61.8\" y=\"-217\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n",
+ "<polygon fill=\"#ffffff\" stroke=\"black\" stroke-dasharray=\"5,2\" points=\"88.8,-305.6 34.8,-305.6 34.8,-269 88.8,-269 88.8,-305.6\"/>\n",
+ "<text text-anchor=\"middle\" x=\"61.8\" y=\"-281.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">input</text>\n",
"</g>\n",
"<!-- function -->\n",
"<g id=\"node12\" class=\"node\">\n",
"<title>function</title>\n",
- "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M84.23,-296.1C84.23,-296.1 39.38,-296.1 39.38,-296.1 33.38,-296.1 27.38,-290.1 27.38,-284.1 27.38,-284.1 27.38,-271.5 27.38,-271.5 27.38,-265.5 33.38,-259.5 39.38,-259.5 39.38,-259.5 84.23,-259.5 84.23,-259.5 90.23,-259.5 96.23,-265.5 96.23,-271.5 96.23,-271.5 96.23,-284.1 96.23,-284.1 96.23,-290.1 90.23,-296.1 84.23,-296.1\"/>\n",
- "<text text-anchor=\"middle\" x=\"61.8\" y=\"-272\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
+ "<path fill=\"#b4d8e4\" stroke=\"black\" d=\"M84.23,-250.6C84.23,-250.6 39.38,-250.6 39.38,-250.6 33.38,-250.6 27.38,-244.6 27.38,-238.6 27.38,-238.6 27.38,-226 27.38,-226 27.38,-220 33.38,-214 39.38,-214 39.38,-214 84.23,-214 84.23,-214 90.23,-214 96.23,-220 96.23,-226 96.23,-226 96.23,-238.6 96.23,-238.6 96.23,-244.6 90.23,-250.6 84.23,-250.6\"/>\n",
+ "<text text-anchor=\"middle\" x=\"61.8\" y=\"-226.5\" font-family=\"Helvetica,sans-Serif\" font-size=\"14.00\">function</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
- "<graphviz.graphs.Digraph at 0x1255f0940>"
+ "<graphviz.graphs.Digraph at 0x29fede890>"
]
},
"execution_count": 2,
@@ -485,7 +485,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
- "<!-- Generated by graphviz version 10.0.1 (20240210.2158)\n",
+ "<!-- Generated by graphviz version 8.1.0 (20230707.0739)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"292pt\" height=\"194pt\"\n",
@@ -507,14 +507,14 @@
"<!-- ai_converse&#45;&gt;human_converse -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>ai_converse&#45;&gt;human_converse</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M48.07,-149.08C47.49,-143.25 47.27,-136.59 47.42,-130.14\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"50.89,-130.66 47.98,-120.48 43.9,-130.26 50.89,-130.66\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M48.07,-149.08C47.48,-143.11 47.26,-136.26 47.43,-129.65\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"50.96,-130.16 48.06,-119.97 43.98,-129.74 50.96,-130.16\"/>\n",
"</g>\n",
"<!-- human_converse&#45;&gt;ai_converse -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>human_converse&#45;&gt;ai_converse</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M60.19,-118.97C60.76,-124.8 60.98,-131.46 60.83,-137.92\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"57.36,-137.38 60.27,-147.57 64.34,-137.79 57.36,-137.38\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M60.19,-118.97C60.78,-124.95 60.99,-131.8 60.82,-138.4\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"57.28,-137.89 60.18,-148.08 64.27,-138.31 57.28,-137.89\"/>\n",
"</g>\n",
"<!-- terminal -->\n",
"<g id=\"node4\" class=\"node\">\n",
@@ -525,8 +525,8 @@
"<!-- human_converse&#45;&gt;terminal -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>human_converse&#45;&gt;terminal</title>\n",
- "<path fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" d=\"M54.12,-82.03C54.12,-72.01 54.12,-59.18 54.12,-47.71\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"57.63,-47.95 54.13,-37.95 50.63,-47.95 57.63,-47.95\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" stroke-dasharray=\"5,2\" d=\"M54.12,-82.03C54.12,-71.91 54.12,-58.91 54.12,-47.35\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"57.63,-47.43 54.12,-37.43 50.63,-47.43 57.63,-47.43\"/>\n",
"<text text-anchor=\"middle\" x=\"98.38\" y=\"-54.2\" font-family=\"Times,serif\" font-size=\"14.00\">&#39;exit&#39; in question</text>\n",
"</g>\n",
"<!-- input__user_question -->\n",
@@ -538,14 +538,14 @@
"<!-- input__user_question&#45;&gt;human_converse -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>input__user_question&#45;&gt;human_converse</title>\n",
- "<path fill=\"none\" stroke=\"black\" d=\"M162.9,-150.6C144.9,-142.48 122.71,-132.46 103.08,-123.6\"/>\n",
- "<polygon fill=\"black\" stroke=\"black\" points=\"104.72,-120.5 94.16,-119.57 101.84,-126.88 104.72,-120.5\"/>\n",
+ "<path fill=\"none\" stroke=\"black\" d=\"M162.9,-150.6C144.74,-142.4 122.3,-132.28 102.54,-123.35\"/>\n",
+ "<polygon fill=\"black\" stroke=\"black\" points=\"104.34,-119.87 93.78,-118.95 101.46,-126.25 104.34,-119.87\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
- "<graphviz.graphs.Digraph at 0x130bc5ff0>"
+ "<graphviz.graphs.Digraph at 0x29e999b90>"
]
},
"execution_count": 6,
@@ -575,7 +575,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"id": "8bcfe9ca48f87618",
"metadata": {
"ExecuteTime": {
@@ -592,7 +592,7 @@
"name": "stdin",
"output_type": "stream",
"text": [
- "Ask something (or type exit to quit): Who is Stefan? Please answer in English.\n"
+ "Ask something (or type exit to quit): elijah's favorite food\n"
]
},
{
@@ -600,15 +600,16 @@
"output_type": "stream",
"text": [
"⏳Processing input from user...\n",
- "🎙💬 Who is Stefan? Please answer in English. \n",
+ "🎙💬 elijah's favorite food \n",
"\n",
"Ran action human_converse with result:\n",
- " {'question': 'Who is Stefan? Please answer in English.'} \n",
+ " {'question': \"elijah's favorite food\"} \n",
" and state:\n",
" {'__PRIOR_STEP': 'human_converse',\n",
- " '__SEQUENCE_ID': 0,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.'],\n",
- " 'question': 'Who is Stefan? Please answer in English.'}\n"
+ " '__SEQUENCE_ID': 1,\n",
+ " 'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\"],\n",
+ " 'question': \"elijah's favorite food\"}\n"
]
}
],
@@ -623,7 +624,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"id": "81940578d58fd602",
"metadata": {
"ExecuteTime": {
@@ -641,19 +642,17 @@
"output_type": "stream",
"text": [
"🤔 AI is thinking...\n",
- "🤖💬 Stefan is someone who likes tacos, used to work at IBM, worked at Stitch Fix, and likes to bake sourdough. \n",
+ "🤖💬 Mango \n",
"\n",
"Ran action ai_converse with result:\n",
- " {'conversational_rag_response': 'Stefan is someone who likes tacos, used to '\n",
- " 'work at IBM, worked at Stitch Fix, and likes '\n",
- " 'to bake sourdough.'} \n",
+ " {'conversational_rag_response': 'Mango'} \n",
" and state:\n",
" {'__PRIOR_STEP': 'ai_converse',\n",
- " '__SEQUENCE_ID': 1,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.'],\n",
- " 'question': 'Who is Stefan? Please answer in English.'}\n"
+ " '__SEQUENCE_ID': 2,\n",
+ " 'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango'],\n",
+ " 'question': \"elijah's favorite food\"}\n"
]
}
],
@@ -681,7 +680,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": 10,
"id": "be6c573158b65cb1",
"metadata": {
"ExecuteTime": {
@@ -700,94 +699,18 @@
"text": [
"Running RAG with initial state:\n",
" {'__PRIOR_STEP': 'ai_converse',\n",
- " '__SEQUENCE_ID': 1,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.'],\n",
- " 'question': 'Who is Stefan? Please answer in English.'}\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): where does Elijah work?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 where does Elijah work? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Elijah works at TwoSigma. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): what should I buy him to eat?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 what should I buy him to eat? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 You should buy Elijah some mangoes to eat. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): What type of mangoes does he like?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 What type of mangoes does he like? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 It is not specified what type of mangoes Elijah likes in the given context. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): Who is the most likely person to like corn & beans?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 Who is the most likely person to like corn & beans? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Stefan is most likely to enjoy eating corn and beans. \n",
- "\n"
+ " '__SEQUENCE_ID': 2,\n",
+ " 'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango'],\n",
+ " 'question': \"elijah's favorite food\"}\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
- "Ask something (or type exit to quit): Why?\n"
+ "Ask something (or type exit to quit): stefan's favorite food\n"
]
},
{
@@ -795,10 +718,10 @@
"output_type": "stream",
"text": [
"⏳Processing input from user...\n",
- "🎙💬 Why? \n",
+ "🎙💬 stefan's favorite food \n",
"\n",
"🤔 AI is thinking...\n",
- "🤖💬 There is no clear indication in the context provided that Stefan would be the most likely person to enjoy eating corn and beans. The information suggests that Stefan enjoys tacos and baking sourdough, but there is nothing regarding his preferences for corn and beans specifically. \n",
+ "🤖💬 Tacos \n",
"\n"
]
},
@@ -816,24 +739,11 @@
"⏳Processing input from user...\n",
"🎙💬 exit \n",
"\n",
- "{'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.',\n",
+ "{'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango',\n",
+ " \"Human: stefan's favorite food\",\n",
+ " 'AI: Tacos',\n",
" 'Human: exit']}\n"
]
}
@@ -884,7 +794,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": 11,
"id": "c7f4dd64f73ed2d8",
"metadata": {
"ExecuteTime": {
@@ -901,27 +811,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "Loaded state from app_id:63fce731-8cc8-4de0-b8dc-0a5f1a057a11, sequence_id:11::\n",
- " {'__SEQUENCE_ID': 11,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.'],\n",
- " 'question': 'Why?'}\n"
+ "Loaded state from app_id:40043560-be53-4372-955e-3c7c725379b2, sequence_id:4::\n",
+ " {'__SEQUENCE_ID': 4,\n",
+ " 'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango',\n",
+ " \"Human: stefan's favorite food\",\n",
+ " 'AI: Tacos'],\n",
+ " 'question': \"stefan's favorite food\"}\n"
]
}
],
@@ -946,7 +843,7 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"id": "5ee618e3-15c0-403b-bc96-3a2faaea457e",
"metadata": {},
"outputs": [],
@@ -984,7 +881,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"id": "34140c5864b940dc",
"metadata": {
"ExecuteTime": {
@@ -996,134 +893,7 @@
"outputs_hidden": false
}
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Running RAG with loaded state:\n",
- " {'__SEQUENCE_ID': 11,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.'],\n",
- " 'question': 'Why?'}\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): does Harrison like pizza?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 does Harrison like pizza? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 There is no information provided in the context to determine whether Harrison likes pizza or not. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): Who should I take to a Mexican restaurant?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 Who should I take to a Mexican restaurant? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Stefan \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): Who worked at TwoSigma?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 Who worked at TwoSigma? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Elijah worked at TwoSigma. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): exit\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 exit \n",
- "\n",
- "{'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.',\n",
- " 'Human: does Harrison like pizza?',\n",
- " 'AI: There is no information provided in the context to '\n",
- " 'determine whether Harrison likes pizza or not.',\n",
- " 'Human: Who should I take to a Mexican restaurant?',\n",
- " 'AI: Stefan',\n",
- " 'Human: Who worked at TwoSigma?',\n",
- " 'AI: Elijah worked at TwoSigma.',\n",
- " 'Human: exit']}\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# We can now change test, debug, etc. from this prior state.\n",
"print(f\"Running RAG with loaded state:\\n {pprint.pformat(state_values)}\")\n",
@@ -1151,7 +921,7 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": null,
"id": "fc62a033644c7b80",
"metadata": {
"ExecuteTime": {
@@ -1208,7 +978,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": null,
"id": "b6d23d6d6a6643d0",
"metadata": {
"ExecuteTime": {
@@ -1220,160 +990,7 @@
"outputs_hidden": false
}
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Running RAG with loaded state:\n",
- " {'__PRIOR_STEP': 'terminal',\n",
- " '__SEQUENCE_ID': 13,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.',\n",
- " 'Human: exit'],\n",
- " 'question': 'exit'}\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): Tell me what you know about Harrison?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 Tell me what you know about Harrison? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Based on the context provided, I know that Harrison worked at Kensho. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): What about Elijah?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 What about Elijah? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Elijah enjoys biking, likes mango, and has worked at TwoSigma. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): What can you tell me about TwoSigma?\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 What can you tell me about TwoSigma? \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 Elijah worked at TwoSigma. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): quit\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 quit \n",
- "\n",
- "🤔 AI is thinking...\n",
- "🤖💬 There is no information provided indicating whether or not the conversation was ended. \n",
- "\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- "Ask something (or type exit to quit): exit\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "⏳Processing input from user...\n",
- "🎙💬 exit \n",
- "\n",
- "{'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: What type of mangoes does he like?',\n",
- " 'AI: It is not specified what type of mangoes Elijah likes '\n",
- " 'in the given context.',\n",
- " 'Human: Who is the most likely person to like corn & beans?',\n",
- " 'AI: Stefan is most likely to enjoy eating corn and beans.',\n",
- " 'Human: Why?',\n",
- " 'AI: There is no clear indication in the context provided '\n",
- " 'that Stefan would be the most likely person to enjoy eating '\n",
- " 'corn and beans. The information suggests that Stefan enjoys '\n",
- " 'tacos and baking sourdough, but there is nothing regarding '\n",
- " 'his preferences for corn and beans specifically.',\n",
- " 'Human: exit',\n",
- " 'Human: Tell me what you know about Harrison?',\n",
- " 'AI: Based on the context provided, I know that Harrison '\n",
- " 'worked at Kensho.',\n",
- " 'Human: What about Elijah?',\n",
- " 'AI: Elijah enjoys biking, likes mango, and has worked at '\n",
- " 'TwoSigma.',\n",
- " 'Human: What can you tell me about TwoSigma?',\n",
- " 'AI: Elijah worked at TwoSigma.',\n",
- " 'Human: quit',\n",
- " 'AI: There is no information provided indicating whether or '\n",
- " 'not the conversation was ended.',\n",
- " 'Human: exit']}\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"print(f\"Running RAG with loaded state:\\n {pprint.pformat(pick_up_where_we_left_off_app.state.get_all())}\")\n",
"while True:\n",
@@ -1404,7 +1021,7 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": 12,
"id": "84d533ba-fd85-4b67-a6c3-30356cc9b048",
"metadata": {},
"outputs": [],
@@ -1456,7 +1073,7 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": 13,
"id": "a9086e58-eeaa-4886-a113-5c7fd5fe0af0",
"metadata": {},
"outputs": [
@@ -1466,21 +1083,20 @@
"text": [
"Running RAG with loaded state:\n",
" {'__SEQUENCE_ID': 5,\n",
- " 'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.'],\n",
- " 'question': 'what should I buy him to eat?'}\n"
+ " 'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango',\n",
+ " \"Human: stefan's favorite food\",\n",
+ " 'AI: Tacos',\n",
+ " 'Human: exit'],\n",
+ " 'question': 'exit'}\n"
]
},
{
"name": "stdin",
"output_type": "stream",
"text": [
- "Ask something (or type exit to quit): who should I go on a bike ride with?\n"
+ "Ask something (or type exit to quit): stefan's food\n"
]
},
{
@@ -1488,10 +1104,10 @@
"output_type": "stream",
"text": [
"⏳Processing input from user...\n",
- "🎙💬 who should I go on a bike ride with? \n",
+ "🎙💬 stefan's food \n",
"\n",
"🤔 AI is thinking...\n",
- "🤖💬 You should go on a bike ride with Elijah. \n",
+ "🤖💬 Tacos \n",
"\n"
]
},
@@ -1499,7 +1115,7 @@
"name": "stdin",
"output_type": "stream",
"text": [
- "Ask something (or type exit to quit): I have too much flour, who do you think I should gift it to?\n"
+ "Ask something (or type exit to quit): elijah's food\n"
]
},
{
@@ -1507,10 +1123,10 @@
"output_type": "stream",
"text": [
"⏳Processing input from user...\n",
- "🎙💬 I have too much flour, who do you think I should gift it to? \n",
+ "🎙💬 elijah's food \n",
"\n",
"🤔 AI is thinking...\n",
- "🤖💬 Based on the context provided, Stefan seems like the best candidate to gift your excess flour to as he enjoys baking sourdough. \n",
+ "🤖💬 Mango \n",
"\n"
]
},
@@ -1528,20 +1144,16 @@
"⏳Processing input from user...\n",
"🎙💬 exit \n",
"\n",
- "{'chat_history': ['Human: Who is Stefan? Please answer in English.',\n",
- " 'AI: Stefan is someone who likes tacos, used to work at IBM, '\n",
- " 'worked at Stitch Fix, and likes to bake sourdough.',\n",
- " 'Human: where does Elijah work?',\n",
- " 'AI: Elijah works at TwoSigma.',\n",
- " 'Human: what should I buy him to eat?',\n",
- " 'AI: You should buy Elijah some mangoes to eat.',\n",
- " 'Human: who should I go on a bike ride with?',\n",
- " 'AI: You should go on a bike ride with Elijah.',\n",
- " 'Human: I have too much flour, who do you think I should '\n",
- " 'gift it to?',\n",
- " 'AI: Based on the context provided, Stefan seems like the '\n",
- " 'best candidate to gift your excess flour to as he enjoys '\n",
- " 'baking sourdough.',\n",
+ "{'chat_history': [\"Human: harrison's favorite food\",\n",
+ " \"Human: elijah's favorite food\",\n",
+ " 'AI: Mango',\n",
+ " \"Human: stefan's favorite food\",\n",
+ " 'AI: Tacos',\n",
+ " 'Human: exit',\n",
+ " \"Human: stefan's food\",\n",
+ " 'AI: Tacos',\n",
+ " \"Human: elijah's food\",\n",
+ " 'AI: Mango',\n",
" 'Human: exit']}\n"
]
}
@@ -1563,18 +1175,10 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"id": "d6523a54-e333-4d5e-941d-d3b28b940500",
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "LocalTrackingClient returned None while trying to fork from: partition_key:None, app_id:NO_SUCH_APP_ID, sequence_id:None. You explicitly requested to fork from a prior application run, but it does not exist. Defaulting to state defaults instead.\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# this should print some warnings:\n",
"new_app_id = str(uuid.uuid4())\n",
@@ -1640,7 +1244,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.10.4"
+ "version": "3.11.6"
}
},
"nbformat": 4,
diff --git a/telemetry/ui/src/api/index.ts b/telemetry/ui/src/api/index.ts
index 62e09c82..14927baf 100644
--- a/telemetry/ui/src/api/index.ts
+++ b/telemetry/ui/src/api/index.ts
@@ -20,6 +20,7 @@ export type { EndEntryModel } from './models/EndEntryModel';
export type { EndSpanModel } from './models/EndSpanModel';
export type { Feedback } from './models/Feedback';
export type { HTTPValidationError } from './models/HTTPValidationError';
+export type { PointerModel } from './models/PointerModel';
export type { Project } from './models/Project';
export type { QuestionAnswers } from './models/QuestionAnswers';
export type { Span } from './models/Span';
diff --git a/telemetry/ui/src/api/models/ActionModel.ts b/telemetry/ui/src/api/models/ActionModel.ts
index ecda2183..12685ab9 100644
--- a/telemetry/ui/src/api/models/ActionModel.ts
+++ b/telemetry/ui/src/api/models/ActionModel.ts
@@ -12,4 +12,5 @@ export type ActionModel = {
writes: Array<string>;
code: string;
inputs?: Array<string>;
+ optional_inputs?: Array<string>;
};
diff --git a/telemetry/ui/src/api/models/ApplicationLogs.ts b/telemetry/ui/src/api/models/ApplicationLogs.ts
index cf0ec200..6a1c8f1e 100644
--- a/telemetry/ui/src/api/models/ApplicationLogs.ts
+++ b/telemetry/ui/src/api/models/ApplicationLogs.ts
@@ -3,13 +3,14 @@
/* tslint:disable */
/* eslint-disable */
import type { ApplicationModel } from './ApplicationModel';
+import type { PointerModel } from './PointerModel';
import type { Step } from './Step';
/**
* Application logs are purely flat --
* we will likely be rethinking this but for now this provides for easy parsing.
*/
export type ApplicationLogs = {
- application: ApplicationModel;
- steps: Array<Step>;
+ application: ApplicationModel;
+ steps: Array<Step>;
+ parent_pointer?: PointerModel | null;
};
-
diff --git a/telemetry/ui/src/api/models/ApplicationSummary.ts b/telemetry/ui/src/api/models/ApplicationSummary.ts
index 0f76a9ac..ecf2e867 100644
--- a/telemetry/ui/src/api/models/ApplicationSummary.ts
+++ b/telemetry/ui/src/api/models/ApplicationSummary.ts
@@ -2,6 +2,7 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
+import type { PointerModel } from './PointerModel';
export type ApplicationSummary = {
app_id: string;
partition_key: string | null;
@@ -9,4 +10,5 @@ export type ApplicationSummary = {
last_written: string;
num_steps: number;
tags: Record<string, string>;
+ parent_pointer?: PointerModel | null;
};
diff --git a/telemetry/ui/src/api/models/PointerModel.ts b/telemetry/ui/src/api/models/PointerModel.ts
new file mode 100644
index 00000000..d70e44e9
--- /dev/null
+++ b/telemetry/ui/src/api/models/PointerModel.ts
@@ -0,0 +1,11 @@
+/* generated using openapi-typescript-codegen -- do no edit */
+/* istanbul ignore file */
+/* tslint:disable */
+/* eslint-disable */
+export type PointerModel = {
+ type?: string;
+ app_id: string;
+ sequence_id: (number | null);
+ partition_key: (string | null);
+};
+
diff --git a/telemetry/ui/src/components/common/chip.tsx b/telemetry/ui/src/components/common/chip.tsx
index 117b1b9b..06c1aa0a 100644
--- a/telemetry/ui/src/components/common/chip.tsx
+++ b/telemetry/ui/src/components/common/chip.tsx
@@ -8,7 +8,8 @@ const chipColorMap = {
failure: 'bg-dwred',
running: 'bg-dwlightblue',
demo: 'bg-yellow-400',
- test: 'bg-gray-800'
+ test: 'bg-gray-800',
+ fork: 'bg-dwdarkblue/80'
};
export type ChipType = keyof typeof chipColorMap;
diff --git a/telemetry/ui/src/components/routes/AppList.tsx b/telemetry/ui/src/components/routes/AppList.tsx
index 9d67c8f7..d53c4574 100644
--- a/telemetry/ui/src/components/routes/AppList.tsx
+++ b/telemetry/ui/src/components/routes/AppList.tsx
@@ -4,10 +4,10 @@ import { Loading } from '../common/loading';
import { ApplicationSummary, DefaultService } from '../../api';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../common/table';
import { DateTimeDisplay } from '../common/dates';
-import { Button } from '../common/button';
import { useState } from 'react';
import { FunnelIcon } from '@heroicons/react/24/outline';
import { useNavigate } from 'react-router-dom';
+import { MdForkRight } from 'react-icons/md';
const StepCountHeader = (props: {
displayZeroCount: boolean;
@@ -23,11 +23,19 @@ const StepCountHeader = (props: {
props.setDisplayZeroCount(!props.displayZeroCount);
}}
/>
- <span>Count</span>
+ <span>Seq ID</span>
</div>
);
};
+const getForkID = (app: ApplicationSummary) => {
+ if (app.parent_pointer) {
+ return app.parent_pointer.app_id;
+ } else {
+ return null;
+ }
+};
+
/**
* List of applications. Purely rendering a list, also sorts them.
*/
@@ -50,6 +58,7 @@ export const AppListTable = (props: { apps: ApplicationSummary[]; projectId: str
<TableHeader>ID</TableHeader>
<TableHeader>First Seen</TableHeader>
<TableHeader>Last Run</TableHeader>
+ <TableHeader>Forked</TableHeader>
<TableHeader>
<StepCountHeader
displayZeroCount={displayZeroCount}
@@ -61,30 +70,41 @@ export const AppListTable = (props: { apps: ApplicationSummary[]; projectId: str
</TableRow>
</TableHead>
<TableBody>
- {appsToDisplay.map((app) => (
- <TableRow
- key={app.app_id}
- className="hover:bg-gray-50 cursor-pointer"
- onClick={() => {
- navigate(`/project/${props.projectId}/${app.app_id}`);
- }}
- >
- <TableCell className="text-gray-600 font-sans">{app.partition_key}</TableCell>
- <TableCell className="font-semibold text-gray-700">{app.app_id}</TableCell>
- <TableCell>
- <DateTimeDisplay date={app.first_written} mode="long" />
- </TableCell>
- <TableCell>
- <DateTimeDisplay date={app.last_written} mode="long" />
- </TableCell>
- <TableCell>{app.num_steps}</TableCell>
- <TableCell>
- <Button color="white" className={'cursor-pointer'}>
- Steps
- </Button>
- </TableCell>
- </TableRow>
- ))}
+ {appsToDisplay.map((app) => {
+ const forkID = getForkID(app);
+ return (
+ <TableRow
+ key={app.app_id}
+ className="hover:bg-gray-50 cursor-pointer"
+ onClick={() => {
+ navigate(`/project/${props.projectId}/${app.app_id}`);
+ }}
+ >
+ <TableCell className="text-gray-600 font-sans">{app.partition_key}</TableCell>
+ <TableCell className="font-semibold text-gray-700">{app.app_id}</TableCell>
+ <TableCell>
+ <DateTimeDisplay date={app.first_written} mode="long" />
+ </TableCell>
+ <TableCell>
+ <DateTimeDisplay date={app.last_written} mode="long" />
+ </TableCell>
+ <TableCell className="z-50">
+ {forkID ? (
+ <MdForkRight
+ className=" hover:scale-125 h-5 w-5 text-gray-600 "
+ onClick={(e) => {
+ navigate(`/project/${props.projectId}/${forkID}`);
+ e.stopPropagation();
+ }}
+ />
+ ) : (
+ <></>
+ )}
+ </TableCell>
+ <TableCell>{app.num_steps}</TableCell>
+ </TableRow>
+ );
+ })}
</TableBody>
</Table>
);
diff --git a/telemetry/ui/src/components/routes/app/AppView.tsx b/telemetry/ui/src/components/routes/app/AppView.tsx
index 4ee60a4f..5708d791 100644
--- a/telemetry/ui/src/components/routes/app/AppView.tsx
+++ b/telemetry/ui/src/components/routes/app/AppView.tsx
@@ -212,6 +212,8 @@ export const AppView = (props: {
setAutoRefresh={setAutoRefresh}
minimized={minimizedTable}
setMinimized={setMinimizedTable}
+ projectId={projectId}
+ parentPointer={data?.parent_pointer || undefined}
/>
</div>
{props.orientation === 'stacked_horizontal' && (
diff --git a/telemetry/ui/src/components/routes/app/StepList.tsx b/telemetry/ui/src/components/routes/app/StepList.tsx
index f2c1f079..1127716f 100644
--- a/telemetry/ui/src/components/routes/app/StepList.tsx
+++ b/telemetry/ui/src/components/routes/app/StepList.tsx
@@ -1,4 +1,4 @@
-import { Span, Step } from '../../../api';
+import { PointerModel, Span, Step } from '../../../api';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../common/table';
import { DateTimeDisplay, DurationDisplay, TimeDisplay } from '../../common/dates';
import { backgroundColorsForIndex, backgroundColorsForStatus } from './AppView';
@@ -16,6 +16,8 @@ import {
import { PauseIcon } from '@heroicons/react/24/solid';
import { RiCornerDownRightLine } from 'react-icons/ri';
+import { MdForkRight } from 'react-icons/md';
+import { Link } from 'react-router-dom';
/**
* Quick display to suggest that the action is still running
@@ -330,6 +332,8 @@ export const StepList = (props: {
setAutoRefresh: (b: boolean) => void;
minimized: boolean;
setMinimized: (b: boolean) => void;
+ projectId: string;
+ parentPointer: PointerModel | undefined;
}) => {
// This is a quick way of expanding the actions all at once
const [expandedActions, setExpandedActions] = useState<number[]>([]);
@@ -359,6 +363,7 @@ export const StepList = (props: {
};
const MinimizeTableIcon = props.minimized ? ChevronRightIcon : ChevronLeftIcon;
const hasAnySpans = props.steps.some((step) => step.spans.length > 0);
+ // const hasParent = props.
return (
<Table dense={2}>
<TableHead className=" bg-white">
@@ -453,6 +458,30 @@ export const StepList = (props: {
</>
);
})}
+ {props.parentPointer ? (
+ <TableRow className="text-gray-500 cursor-pointer bg-gray-100">
+ <TableCell colSpan={1} className="items-center justify-start max-w-20">
+ {props.parentPointer.sequence_id}
+ </TableCell>
+ <TableCell colSpan={4} className="text-gray-500">
+ <div className="flex flex-row gap-2 items-center ">
+ <MdForkRight className="h-5 w-5 -ml-1.5" />
+ <Link to={`/project/${props.projectId}/${props.parentPointer.app_id}`}>
+ <span className="hover:underline">{props.parentPointer.app_id}</span>
+ </Link>
+ </div>
+ </TableCell>
+ <TableCell colSpan={1} className="text-gray-500">
+ <Chip
+ label={'forked'}
+ chipType={'fork'}
+ className="w-16 flex flex-row justify-center"
+ />
+ </TableCell>
+ </TableRow>
+ ) : (
+ <></>
+ )}
</TableBody>
</Table>
);