mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-14 09:15:13 +02:00
IAM tech spec: Auth and access management current state and proposed
changes. Support for separate workspaces Addition of workspace CLI support for test purposes
This commit is contained in:
parent
48da6c5f8b
commit
db05427d0e
219 changed files with 4875 additions and 2616 deletions
|
|
@ -18,16 +18,17 @@ from trustgraph.api import (
|
|||
|
||||
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||
default_token = os.getenv("TRUSTGRAPH_TOKEN", None)
|
||||
default_user = 'trustgraph'
|
||||
default_workspace = os.getenv("TRUSTGRAPH_WORKSPACE", "default")
|
||||
default_collection = 'default'
|
||||
default_doc_limit = 10
|
||||
|
||||
|
||||
def question_explainable(
|
||||
url, flow_id, question_text, user, collection, doc_limit, token=None, debug=False
|
||||
url, flow_id, question_text, user, collection, doc_limit, token=None, debug=False,
|
||||
workspace="default",
|
||||
):
|
||||
"""Execute document RAG with explainability - shows provenance events inline."""
|
||||
api = Api(url=url, token=token)
|
||||
api = Api(url=url, token=token, workspace=workspace)
|
||||
socket = api.socket()
|
||||
flow = socket.flow(flow_id)
|
||||
explain_client = ExplainabilityClient(flow, retry_delay=0.2, max_retries=10)
|
||||
|
|
@ -100,7 +101,7 @@ def question_explainable(
|
|||
def question(
|
||||
url, flow_id, question_text, user, collection, doc_limit,
|
||||
streaming=True, token=None, explainable=False, debug=False,
|
||||
show_usage=False
|
||||
show_usage=False, workspace="default",
|
||||
):
|
||||
# Explainable mode uses the API to capture and process provenance events
|
||||
if explainable:
|
||||
|
|
@ -112,12 +113,13 @@ def question(
|
|||
collection=collection,
|
||||
doc_limit=doc_limit,
|
||||
token=token,
|
||||
debug=debug
|
||||
debug=debug,
|
||||
workspace=workspace,
|
||||
)
|
||||
return
|
||||
|
||||
# Create API client
|
||||
api = Api(url=url, token=token)
|
||||
api = Api(url=url, token=token, workspace=workspace)
|
||||
|
||||
if streaming:
|
||||
# Use socket client for streaming
|
||||
|
|
@ -189,6 +191,12 @@ def main():
|
|||
help='Authentication token (default: $TRUSTGRAPH_TOKEN)',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-w', '--workspace',
|
||||
default=default_workspace,
|
||||
help=f'Workspace (default: {default_workspace})',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-f', '--flow-id',
|
||||
default="default",
|
||||
|
|
@ -201,12 +209,6 @@ def main():
|
|||
help=f'Question to answer',
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-U', '--user',
|
||||
default=default_user,
|
||||
help=f'User ID (default: {default_user})'
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
'-C', '--collection',
|
||||
default=default_collection,
|
||||
|
|
@ -252,7 +254,7 @@ def main():
|
|||
url=args.url,
|
||||
flow_id=args.flow_id,
|
||||
question_text=args.question,
|
||||
user=args.user,
|
||||
user="",
|
||||
collection=args.collection,
|
||||
doc_limit=args.doc_limit,
|
||||
streaming=not args.no_streaming,
|
||||
|
|
@ -260,6 +262,7 @@ def main():
|
|||
explainable=args.explainable,
|
||||
debug=args.debug,
|
||||
show_usage=args.show_usage,
|
||||
workspace=args.workspace,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue