mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-20 21:05:13 +02:00
Python API implements streaming interfaces (#577)
* Tech spec * Python CLI utilities updated to use the API including streaming features * Added type safety to Python API * Completed missing auth token support in CLI
This commit is contained in:
parent
b957004db9
commit
01aeede78b
53 changed files with 4489 additions and 715 deletions
|
|
@ -26,6 +26,7 @@ import textwrap
|
|||
import dataclasses
|
||||
|
||||
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
||||
|
||||
@dataclasses.dataclass
|
||||
class Argument:
|
||||
|
|
@ -67,9 +68,10 @@ def set_tool(
|
|||
group : List[str],
|
||||
state : str,
|
||||
applicable_states : List[str],
|
||||
token : str = None,
|
||||
):
|
||||
|
||||
api = Api(url).config()
|
||||
api = Api(url, token=token).config()
|
||||
|
||||
values = api.get([
|
||||
ConfigKey(type="agent", key="tool-index")
|
||||
|
|
@ -156,6 +158,12 @@ def main():
|
|||
help=f'API URL (default: {default_url})',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-t', '--token',
|
||||
default=default_token,
|
||||
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'--id',
|
||||
help=f'Unique tool identifier',
|
||||
|
|
@ -257,6 +265,7 @@ def main():
|
|||
group=args.group,
|
||||
state=args.state,
|
||||
applicable_states=args.applicable_states,
|
||||
token=args.token,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue