mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-26 00:46:22 +02:00
Extend use of user + collection fields (#503)
* Collection+user fields in structured query * User/collection in structured query & agent
This commit is contained in:
parent
a92050c411
commit
f22bf13aa6
15 changed files with 122 additions and 45 deletions
|
|
@ -132,11 +132,15 @@ class FlowInstance:
|
|||
input
|
||||
)["response"]
|
||||
|
||||
def agent(self, question):
|
||||
def agent(self, question, user="trustgraph", state="", group=None, history=None):
|
||||
|
||||
# The input consists of a question
|
||||
# The input consists of a question and optional context
|
||||
input = {
|
||||
"question": question
|
||||
"question": question,
|
||||
"user": user,
|
||||
"state": state,
|
||||
"group": group or [],
|
||||
"history": history or []
|
||||
}
|
||||
|
||||
return self.request(
|
||||
|
|
@ -456,20 +460,24 @@ class FlowInstance:
|
|||
|
||||
return response
|
||||
|
||||
def structured_query(self, question):
|
||||
def structured_query(self, question, user="trustgraph", collection="default"):
|
||||
"""
|
||||
Execute a natural language question against structured data.
|
||||
Combines NLP query conversion and GraphQL execution.
|
||||
|
||||
Args:
|
||||
question: Natural language question
|
||||
user: Cassandra keyspace identifier (default: "trustgraph")
|
||||
collection: Data collection identifier (default: "default")
|
||||
|
||||
Returns:
|
||||
dict with data and optional errors
|
||||
"""
|
||||
|
||||
input = {
|
||||
"question": question
|
||||
"question": question,
|
||||
"user": user,
|
||||
"collection": collection
|
||||
}
|
||||
|
||||
response = self.request(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue