diff --git a/__init__.py b/__init__.py index fd1b6a6..4c05755 100644 --- a/__init__.py +++ b/__init__.py @@ -4,4 +4,4 @@ JIVAS is an Agentic Framework for rapidly prototyping and deploying graph-based, AI solutions. """ -__version__ = "2.1.20" +__version__ = "2.1.21" diff --git a/core/jivas/agent/action/interact.jac b/core/jivas/agent/action/interact.jac index f120b2b..8e32e84 100644 --- a/core/jivas/agent/action/interact.jac +++ b/core/jivas/agent/action/interact.jac @@ -108,10 +108,13 @@ walker interact(agent_graph_walker) { visit queued_actions; } + self.logger.info(f"Utterance: {self.utterance}"); + } can on_action with InteractAction entry { # performs execute routine for action nodes + self.logger.info(f"Touch: {here.label}"); if not self.is_intended(here) { return; @@ -123,6 +126,7 @@ walker interact(agent_graph_walker) { } if here.touch(self) { + self.logger.info(f"Execute: {here.label}"); # execute the action here.execute(self); self.interaction_node.trail.append(here.label); diff --git a/core/jivas/agent/action/retrieval_interact_action.jac b/core/jivas/agent/action/retrieval_interact_action.jac index a286ece..e239d2e 100644 --- a/core/jivas/agent/action/retrieval_interact_action.jac +++ b/core/jivas/agent/action/retrieval_interact_action.jac @@ -69,6 +69,7 @@ node RetrievalInteractAction(InteractAction) { has model_name:str = "gpt-4o"; has model_temperature:float = 0.2; has model_max_tokens:int = 10000; + has cache_interact_action:str = "CacheInteractAction"; def on_register() { @@ -87,6 +88,19 @@ node RetrievalInteractAction(InteractAction) { def execute(visitor: agent_graph_walker) { + content_filter=""; + if cache_interact_action := self.get_agent().get_action(action_label=self.cache_interact_action) { + cached_result = cache_interact_action.get_cached_response(visitor); + if cached_result.get("message") { + visitor.interaction_node.set_message(cached_result["message"]); + return; + } + + if cache_interact_action.can_use_cache_filter() { + content_filter = "metadata.document_type:!=cache_response"; + } + } + # first prepare the query with context completion # prepare query using conversation history or fallback to original utterance query = self.process_query(visitor); @@ -109,7 +123,7 @@ node RetrievalInteractAction(InteractAction) { interaction_context['query'] = query.get("query", visitor); # handle context, if any and queue directive - if(context_data := self.retrieve_context(interaction_context['query'])) { + if(context_data := self.retrieve_context(query = interaction_context['query'], filter=content_filter)) { context_directive = None; # add raw context to the interaction node @@ -159,6 +173,11 @@ node RetrievalInteractAction(InteractAction) { query = model_action_result.get_json_result(); } } + } else { + query = { + "query": visitor.utterance, + "is_query": True + }; } return query; diff --git a/core/jivas/agent/memory/collection.jac b/core/jivas/agent/memory/collection.jac index e2c6419..d3b21bc 100644 --- a/core/jivas/agent/memory/collection.jac +++ b/core/jivas/agent/memory/collection.jac @@ -1,5 +1,7 @@ import from jivas.agent.core.graph_node { GraphNode } import from jac_cloud.plugin.jaseci { JacPlugin as Jac } +import from jac_cloud.core.archetype { NodeAnchor } + node Collection(GraphNode) { # represents a named collection for long-term memory storage @@ -38,8 +40,20 @@ walker _purge_collection { } can on_collection_node with GraphNode entry { - visit [-->]; - self.removed.append(here); - Jac.destroy(here); + try { + visit [-->]; + self.removed.append(here); + Jac.destroy(here); + } except Exception as e { + node_id = re.search(r'\[(.*?)\]', str(e)).group(1); + filter_query = {"$and": [{"name": "Frame"}, {"archetype.id": node_id}]}; + + if (cursor := NodeAnchor.Collection.find(filter_query)) { + nodes = [n.archetype for n in cursor]; + for node_obj in nodes { + Jac.destroy(node_obj); + } + } + } } } diff --git a/core/setup.py b/core/setup.py index 5549f1b..5dded2d 100644 --- a/core/setup.py +++ b/core/setup.py @@ -42,21 +42,25 @@ def get_version() -> str: package_data={"jivas": []}, python_requires=">=3.12.0", install_requires=[ - "jvcli>=2.1.0", - "jvclient>=0.0.2", - "jvserve>=2.1.0", - "pytz>=2024.2", - "types-pytz>=2024.2.0.20241003", - "schedule>=1.2.2", - "openai>=1.68.2", - "langchain>=0.3.21", - "langchain-community>=0.3.20", - "langchain-core>=0.3.47", - "langchain-experimental>=0.3.4", - "langchain-openai>=0.3.9", - "setuptools>=75.8.1", - "transformers>=4.49.0", - "ftfy>=6.2.3", + "jvcli<=2.1.20", + "jvclient<=2.1.20", + "jvserve<=2.1.20", + "jac-cloud==0.2.7", + "jaclang==0.8.7", + "pytz==2025.2", + "types-pytz==2025.2.0.20250809", + "schedule==1.2.2", + "openai==1.109.1", + "langchain==0.3.27", + "langchain-community==0.3.27", + "langchain-core==0.3.79", + "langchain-experimental==0.3.4", + "langchain-openai==0.3.19", + "langchain-text-splitters==0.3.11", + "langsmith==0.4.38", + "setuptools==80.9.0", + "transformers==4.57.1", + "ftfy==6.3.1", ], extras_require={ "dev": [ diff --git a/jvcli/jvcli/templates/2.1.20/project/README.md b/jvcli/jvcli/templates/2.1.21/project/README.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/README.md rename to jvcli/jvcli/templates/2.1.21/project/README.md diff --git a/jvcli/jvcli/templates/2.1.20/project/actions/README.md b/jvcli/jvcli/templates/2.1.21/project/actions/README.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/actions/README.md rename to jvcli/jvcli/templates/2.1.21/project/actions/README.md diff --git a/jvcli/jvcli/templates/2.1.20/project/daf/README.md b/jvcli/jvcli/templates/2.1.21/project/daf/README.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/daf/README.md rename to jvcli/jvcli/templates/2.1.21/project/daf/README.md diff --git a/jvcli/jvcli/templates/2.1.20/project/env.example b/jvcli/jvcli/templates/2.1.21/project/env.example similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/env.example rename to jvcli/jvcli/templates/2.1.21/project/env.example diff --git a/jvcli/jvcli/templates/2.1.20/project/gitignore.example b/jvcli/jvcli/templates/2.1.21/project/gitignore.example similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/gitignore.example rename to jvcli/jvcli/templates/2.1.21/project/gitignore.example diff --git a/jvcli/jvcli/templates/2.1.20/project/globals.jac b/jvcli/jvcli/templates/2.1.21/project/globals.jac similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/globals.jac rename to jvcli/jvcli/templates/2.1.21/project/globals.jac diff --git a/jvcli/jvcli/templates/2.1.20/project/main.jac b/jvcli/jvcli/templates/2.1.21/project/main.jac similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/main.jac rename to jvcli/jvcli/templates/2.1.21/project/main.jac diff --git a/jvcli/jvcli/templates/2.1.20/project/tests/README.md b/jvcli/jvcli/templates/2.1.21/project/tests/README.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/project/tests/README.md rename to jvcli/jvcli/templates/2.1.21/project/tests/README.md diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/CHANGELOG.md b/jvcli/jvcli/templates/2.1.21/sourcefiles/CHANGELOG.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/CHANGELOG.md rename to jvcli/jvcli/templates/2.1.21/sourcefiles/CHANGELOG.md diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/README.md b/jvcli/jvcli/templates/2.1.21/sourcefiles/README.md similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/README.md rename to jvcli/jvcli/templates/2.1.21/sourcefiles/README.md diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/action_app.py b/jvcli/jvcli/templates/2.1.21/sourcefiles/action_app.py similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/action_app.py rename to jvcli/jvcli/templates/2.1.21/sourcefiles/action_app.py diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/action_archetype.jac b/jvcli/jvcli/templates/2.1.21/sourcefiles/action_archetype.jac similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/action_archetype.jac rename to jvcli/jvcli/templates/2.1.21/sourcefiles/action_archetype.jac diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/action_info.yaml b/jvcli/jvcli/templates/2.1.21/sourcefiles/action_info.yaml similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/action_info.yaml rename to jvcli/jvcli/templates/2.1.21/sourcefiles/action_info.yaml diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/action_lib.jac b/jvcli/jvcli/templates/2.1.21/sourcefiles/action_lib.jac similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/action_lib.jac rename to jvcli/jvcli/templates/2.1.21/sourcefiles/action_lib.jac diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/agent_descriptor.yaml b/jvcli/jvcli/templates/2.1.21/sourcefiles/agent_descriptor.yaml similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/agent_descriptor.yaml rename to jvcli/jvcli/templates/2.1.21/sourcefiles/agent_descriptor.yaml diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/agent_info.yaml b/jvcli/jvcli/templates/2.1.21/sourcefiles/agent_info.yaml similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/agent_info.yaml rename to jvcli/jvcli/templates/2.1.21/sourcefiles/agent_info.yaml diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/agent_knowledge.yaml b/jvcli/jvcli/templates/2.1.21/sourcefiles/agent_knowledge.yaml similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/agent_knowledge.yaml rename to jvcli/jvcli/templates/2.1.21/sourcefiles/agent_knowledge.yaml diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/agent_memory.yaml b/jvcli/jvcli/templates/2.1.21/sourcefiles/agent_memory.yaml similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/agent_memory.yaml rename to jvcli/jvcli/templates/2.1.21/sourcefiles/agent_memory.yaml diff --git a/jvcli/jvcli/templates/2.1.20/sourcefiles/interact_action_archetype.jac b/jvcli/jvcli/templates/2.1.21/sourcefiles/interact_action_archetype.jac similarity index 100% rename from jvcli/jvcli/templates/2.1.20/sourcefiles/interact_action_archetype.jac rename to jvcli/jvcli/templates/2.1.21/sourcefiles/interact_action_archetype.jac diff --git a/jvcli/setup.py b/jvcli/setup.py index 6879d8c..743ca60 100644 --- a/jvcli/setup.py +++ b/jvcli/setup.py @@ -36,17 +36,17 @@ def get_version() -> str: ), include_package_data=True, install_requires=[ - "click>=8.1.8", - "requests>=2.32.3", - "packaging>=24.2", - "pyaml>=25.1.0", - "python-dotenv>=1.0.0", - "semver>=3.0.4", + "click==8.3.0", + "requests==2.32.5", + "packaging==25.0", + "pyaml==25.7.0", + "python-dotenv==1.2.1", + "semver==3.0.4", "node-semver>=0.9.0", - "jaclang", - "pymongo", - "uvicorn", - "fastapi", + "jaclang==0.8.7", + "pymongo==4.11.3", + "uvicorn==0.34.0", + "fastapi==0.115.11", ], extras_require={ "dev": [ diff --git a/jvserve/setup.py b/jvserve/setup.py index 3ad5ed1..2d2f876 100644 --- a/jvserve/setup.py +++ b/jvserve/setup.py @@ -41,13 +41,14 @@ def get_version() -> str: package_data={"jvserve": []}, python_requires=">=3.12.0", install_requires=[ - "jac-cloud>=0.2.5", + "jac-cloud==0.2.7", + "jaclang==0.8.7", "psutil>=7.0.0", - "pyaml>=25.1.0", - "requests>=2.32.3", - "aiohttp>=3.10.10", - "schedule>=1.2.2", - "boto3>=1.37.10", + "pyaml==25.7.0", + "requests==2.32.5", + "aiohttp==3.13.1", + "schedule==1.2.2", + "boto3==1.40.59", ], extras_require={ "dev": [