jvserve 2.0.5__py3-none-any.whl → 2.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jvserve might be problematic. Click here for more details.

jvserve/__init__.py CHANGED
@@ -4,5 +4,5 @@ jvserve package initialization.
4
4
  This package provides the webserver for loading and interacting with JIVAS agents.
5
5
  """
6
6
 
7
- __version__ = "2.0.5"
7
+ __version__ = "2.0.7"
8
8
  __supported__jivas__versions__ = ["2.0.0"]
jvserve/cli.py CHANGED
@@ -6,6 +6,7 @@ import time
6
6
  from contextlib import asynccontextmanager
7
7
  from typing import AsyncIterator, Optional
8
8
 
9
+ from dotenv import load_dotenv
9
10
  from jac_cloud.jaseci.security import authenticator
10
11
  from jaclang.cli.cmdreg import cmd_registry
11
12
  from jaclang.plugin.default import hookimpl
@@ -17,6 +18,8 @@ from jvserve.lib.agent_interface import AgentInterface
17
18
  from jvserve.lib.agent_pulse import AgentPulse
18
19
  from jvserve.lib.jvlogger import JVLogger
19
20
 
21
+ load_dotenv(".env")
22
+
20
23
 
21
24
  class JacCmd:
22
25
  """Jac CLI."""
@@ -11,7 +11,7 @@ from urllib.parse import quote, unquote
11
11
 
12
12
  import aiohttp
13
13
  import requests
14
- from fastapi import Form, Request, UploadFile
14
+ from fastapi import File, Form, Request, UploadFile
15
15
  from fastapi.responses import JSONResponse
16
16
  from jac_cloud.core.architype import AnchorState, Permission, Root
17
17
  from jac_cloud.core.context import (
@@ -158,12 +158,11 @@ class AgentInterface:
158
158
 
159
159
  @staticmethod
160
160
  async def action_walker_exec(
161
- request: Request,
162
161
  agent_id: str = Form(...), # noqa: B008
163
162
  module_root: str = Form(...), # noqa: B008
164
163
  walker: str = Form(...), # noqa: B008
165
164
  args: Optional[str] = Form(None), # noqa: B008
166
- attachments: List[UploadFile] = Form(default_factory=list), # noqa: B008
165
+ attachments: List[UploadFile] = File(default_factory=list), # noqa: B008
167
166
  ) -> JSONResponse:
168
167
  """Execute a named walker exposed by an action within context; capable of handling JSON or file data depending on request"""
169
168
 
@@ -233,10 +232,13 @@ class AgentInterface:
233
232
  """Payload for interacting with the agent."""
234
233
 
235
234
  agent_id: str
236
- utterance: str
237
- session_id: str
238
- tts: bool
239
- verbose: bool
235
+ utterance: Optional[str] = None
236
+ channel: Optional[str] = None
237
+ session_id: Optional[str] = None
238
+ tts: Optional[bool] = None
239
+ verbose: Optional[bool] = None
240
+ data: Optional[dict] = None
241
+ streaming: Optional[bool] = None
240
242
 
241
243
  @staticmethod
242
244
  def interact(payload: InteractPayload) -> dict:
@@ -260,10 +262,13 @@ class AgentInterface:
260
262
  walker_name="interact",
261
263
  attributes={
262
264
  "agent_id": payload.agent_id,
263
- "utterance": payload.utterance,
264
- "session_id": session_id,
265
- "tts": payload.tts,
266
- "verbose": payload.verbose,
265
+ "utterance": payload.utterance or "",
266
+ "channel": payload.channel or "",
267
+ "session_id": session_id or "",
268
+ "tts": payload.tts or False,
269
+ "verbose": payload.verbose or False,
270
+ "data": payload.data or {},
271
+ "streaming": payload.streaming or False,
267
272
  "reporting": False,
268
273
  },
269
274
  module_name="jivas.agent.action.interact",
@@ -384,8 +389,14 @@ class AgentInterface:
384
389
  headers = {}
385
390
  json = {
386
391
  "agent_id": payload.agent_id,
387
- "utterance": payload.utterance,
388
- "session_id": session_id,
392
+ "utterance": payload.utterance or "",
393
+ "channel": payload.channel or "",
394
+ "session_id": session_id or "",
395
+ "tts": payload.tts or False,
396
+ "verbose": payload.verbose or False,
397
+ "data": payload.data or {},
398
+ "streaming": payload.streaming or False,
399
+ "reporting": False,
389
400
  }
390
401
  headers["Authorization"] = "Bearer " + AgentInterface.TOKEN
391
402
 
@@ -9,6 +9,7 @@ from abc import ABC, abstractmethod
9
9
 
10
10
  # Interface type determined by environment variable, defaults to local
11
11
  FILE_INTERFACE = os.environ.get("JIVAS_FILE_INTERFACE", "local")
12
+ DEFAULT_FILES_ROOT = os.environ.get("JIVAS_FILES_ROOT_PATH", ".files")
12
13
 
13
14
 
14
15
  class FileInterface(ABC):
@@ -155,16 +156,21 @@ class S3FileInterface(FileInterface):
155
156
 
156
157
  file_interface: FileInterface
157
158
 
158
- if FILE_INTERFACE == "s3":
159
- file_interface = S3FileInterface(
160
- bucket_name=os.environ.get("JIVAS_S3_BUCKET_NAME", ""),
161
- region_name=os.environ.get("JIVAS_S3_REGION_NAME", "us-east-1"),
162
- aws_access_key_id=os.environ.get("JIVAS_S3_ACCESS_KEY_ID", ""),
163
- aws_secret_access_key=os.environ.get("JIVAS_S3_SECRET_ACCESS_KEY", ""),
164
- endpoint_url=os.environ.get("JIVAS_S3_ENDPOINT_URL"),
165
- files_root=os.environ.get("JIVAS_FILES_ROOT_PATH", ".files"),
166
- )
167
- else:
168
- file_interface = LocalFileInterface(
169
- files_root=os.environ.get("JIVAS_FILES_ROOT_PATH", ".files")
170
- )
159
+
160
+ def get_file_interface(files_root: str = DEFAULT_FILES_ROOT) -> FileInterface:
161
+ """Returns a FileInterface instance based on the configured FILE_INTERFACE."""
162
+
163
+ if FILE_INTERFACE == "s3":
164
+ return S3FileInterface(
165
+ bucket_name=os.environ.get("JIVAS_S3_BUCKET_NAME", ""),
166
+ region_name=os.environ.get("JIVAS_S3_REGION_NAME", "us-east-1"),
167
+ aws_access_key_id=os.environ.get("JIVAS_S3_ACCESS_KEY_ID", ""),
168
+ aws_secret_access_key=os.environ.get("JIVAS_S3_SECRET_ACCESS_KEY", ""),
169
+ endpoint_url=os.environ.get("JIVAS_S3_ENDPOINT_URL"),
170
+ files_root=files_root,
171
+ )
172
+ else:
173
+ return LocalFileInterface(files_root=files_root)
174
+
175
+
176
+ file_interface = get_file_interface()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jvserve
3
- Version: 2.0.5
3
+ Version: 2.0.7
4
4
  Summary: FastAPI webserver for loading and interaction with JIVAS agents.
5
5
  Home-page: https://github.com/TrueSelph/jvserve
6
6
  Author: TrueSelph Inc.
@@ -0,0 +1,13 @@
1
+ jvserve/__init__.py,sha256=g9pUUveC4GidUm97oFNE89_aCnO73a7IIT_6DP7nBP0,190
2
+ jvserve/cli.py,sha256=ltg-n-ZFsvitAGIhxY8xgwPI2CETLanZ_0bqrvsqqg8,4994
3
+ jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
4
+ jvserve/lib/agent_interface.py,sha256=qSMHOonLrwokyeIjk9DdNbgt0uSPfrTWWNDqR3qAsT4,26490
5
+ jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
6
+ jvserve/lib/file_interface.py,sha256=ccnMw5k1NtfK5ylNcvlCJE-Ene3tZigh6Q1gHRy7Sow,6026
7
+ jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
8
+ jvserve-2.0.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
+ jvserve-2.0.7.dist-info/METADATA,sha256=kHsqQ2Eh3fYun93xztnhIQhCi3P-JssXDqr8tMeUGvw,4790
10
+ jvserve-2.0.7.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
11
+ jvserve-2.0.7.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
12
+ jvserve-2.0.7.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
13
+ jvserve-2.0.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,13 +0,0 @@
1
- jvserve/__init__.py,sha256=9CL-E2CABm-lVgkBs0NVCUalG30ORIqxfwa7ie9IWys,190
2
- jvserve/cli.py,sha256=oeWCqA9MAqMYST506f8Nv22qs91OSy555V-NoP-pNOM,4942
3
- jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
4
- jvserve/lib/agent_interface.py,sha256=WFHAxCNbkRhqrOsycRnMtPNOQxHvKbQ4oOifz30WhxE,25801
5
- jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
6
- jvserve/lib/file_interface.py,sha256=lnNOhV9GEmet3-uDQw2hBbvdpnB3-U7amFuR80nv04g,5819
7
- jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
8
- jvserve-2.0.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
9
- jvserve-2.0.5.dist-info/METADATA,sha256=kP5VLkXdZ95-0MN4QOfBClaWiCP9Y97piik7YVO8Jhc,4790
10
- jvserve-2.0.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
11
- jvserve-2.0.5.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
12
- jvserve-2.0.5.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
13
- jvserve-2.0.5.dist-info/RECORD,,