mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-12 23:02:12 +02:00
Updated API specs
This commit is contained in:
parent
ab002e6edb
commit
f6e588d408
13 changed files with 282 additions and 56 deletions
|
|
@ -1,14 +1,57 @@
|
||||||
type: object
|
type: object
|
||||||
description: RDF value - can be entity/URI or literal
|
description: |
|
||||||
required:
|
RDF Term - typed representation of a value in the knowledge graph.
|
||||||
- v
|
|
||||||
- e
|
Term types (discriminated by `t` field):
|
||||||
|
- `i`: IRI (URI reference)
|
||||||
|
- `l`: Literal (string value, optionally with datatype or language tag)
|
||||||
|
- `r`: Quoted triple (RDF-star reification)
|
||||||
|
- `b`: Blank node
|
||||||
properties:
|
properties:
|
||||||
|
t:
|
||||||
|
type: string
|
||||||
|
description: Term type discriminator
|
||||||
|
enum: [i, l, r, b]
|
||||||
|
example: i
|
||||||
|
i:
|
||||||
|
type: string
|
||||||
|
description: IRI value (when t=i)
|
||||||
|
example: http://example.com/Person1
|
||||||
v:
|
v:
|
||||||
type: string
|
type: string
|
||||||
description: Value (URI or literal text)
|
description: Literal value (when t=l)
|
||||||
example: https://example.com/entity1
|
example: John Doe
|
||||||
e:
|
d:
|
||||||
type: boolean
|
type: string
|
||||||
description: True if entity/URI, false if literal
|
description: Datatype IRI for literal (when t=l, optional)
|
||||||
example: true
|
example: http://www.w3.org/2001/XMLSchema#integer
|
||||||
|
l:
|
||||||
|
type: string
|
||||||
|
description: Language tag for literal (when t=l, optional)
|
||||||
|
example: en
|
||||||
|
r:
|
||||||
|
type: object
|
||||||
|
description: Quoted triple (when t=r) - contains s, p, o Term fields
|
||||||
|
properties:
|
||||||
|
s:
|
||||||
|
$ref: '#'
|
||||||
|
p:
|
||||||
|
$ref: '#'
|
||||||
|
o:
|
||||||
|
$ref: '#'
|
||||||
|
required:
|
||||||
|
- t
|
||||||
|
examples:
|
||||||
|
- description: IRI term
|
||||||
|
value:
|
||||||
|
t: i
|
||||||
|
i: http://schema.org/name
|
||||||
|
- description: Literal term
|
||||||
|
value:
|
||||||
|
t: l
|
||||||
|
v: John Doe
|
||||||
|
- description: Literal with language tag
|
||||||
|
value:
|
||||||
|
t: l
|
||||||
|
v: Bonjour
|
||||||
|
l: fr
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
type: object
|
type: object
|
||||||
description: RDF triple (subject-predicate-object)
|
description: |
|
||||||
|
RDF triple (subject-predicate-object), optionally scoped to a named graph.
|
||||||
required:
|
required:
|
||||||
- s
|
- s
|
||||||
- p
|
- p
|
||||||
|
|
@ -14,3 +15,7 @@ properties:
|
||||||
o:
|
o:
|
||||||
$ref: './RdfValue.yaml'
|
$ref: './RdfValue.yaml'
|
||||||
description: Object
|
description: Object
|
||||||
|
g:
|
||||||
|
type: string
|
||||||
|
description: Named graph URI (optional)
|
||||||
|
example: urn:graph:source
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,26 @@ properties:
|
||||||
- action
|
- action
|
||||||
- observation
|
- observation
|
||||||
- answer
|
- answer
|
||||||
|
- final-answer
|
||||||
- error
|
- error
|
||||||
example: answer
|
example: answer
|
||||||
content:
|
content:
|
||||||
type: string
|
type: string
|
||||||
description: Chunk content (streaming mode only)
|
description: Chunk content (streaming mode only)
|
||||||
example: Paris is the capital of France.
|
example: Paris is the capital of France.
|
||||||
|
message_type:
|
||||||
|
type: string
|
||||||
|
description: Message type - "chunk" for agent chunks, "explain" for explainability events
|
||||||
|
enum: [chunk, explain]
|
||||||
|
example: chunk
|
||||||
|
explain_id:
|
||||||
|
type: string
|
||||||
|
description: Explainability node URI (for explain messages)
|
||||||
|
example: urn:trustgraph:agent:abc123
|
||||||
|
explain_graph:
|
||||||
|
type: string
|
||||||
|
description: Named graph containing the explainability data
|
||||||
|
example: urn:graph:retrieval
|
||||||
end-of-message:
|
end-of-message:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Current chunk type is complete (streaming mode)
|
description: Current chunk type is complete (streaming mode)
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,57 @@
|
||||||
type: object
|
type: object
|
||||||
description: |
|
description: |
|
||||||
RDF value - represents either a URI/entity or a literal value.
|
RDF Term - typed representation of a value in the knowledge graph.
|
||||||
|
|
||||||
When `e` is true, `v` must be a full URI (e.g., http://schema.org/name).
|
Term types (discriminated by `t` field):
|
||||||
When `e` is false, `v` is a literal value (string, number, etc.).
|
- `i`: IRI (URI reference)
|
||||||
|
- `l`: Literal (string value, optionally with datatype or language tag)
|
||||||
|
- `r`: Quoted triple (RDF-star reification)
|
||||||
|
- `b`: Blank node
|
||||||
properties:
|
properties:
|
||||||
|
t:
|
||||||
|
type: string
|
||||||
|
description: Term type discriminator
|
||||||
|
enum: [i, l, r, b]
|
||||||
|
example: i
|
||||||
|
i:
|
||||||
|
type: string
|
||||||
|
description: IRI value (when t=i)
|
||||||
|
example: http://example.com/Person1
|
||||||
v:
|
v:
|
||||||
type: string
|
type: string
|
||||||
description: The value - full URI when e=true, literal when e=false
|
description: Literal value (when t=l)
|
||||||
example: http://example.com/Person1
|
example: John Doe
|
||||||
e:
|
d:
|
||||||
type: boolean
|
type: string
|
||||||
description: True if entity/URI, false if literal value
|
description: Datatype IRI for literal (when t=l, optional)
|
||||||
example: true
|
example: http://www.w3.org/2001/XMLSchema#integer
|
||||||
|
l:
|
||||||
|
type: string
|
||||||
|
description: Language tag for literal (when t=l, optional)
|
||||||
|
example: en
|
||||||
|
r:
|
||||||
|
type: object
|
||||||
|
description: Quoted triple (when t=r) - contains s, p, o Term fields
|
||||||
|
properties:
|
||||||
|
s:
|
||||||
|
$ref: '#'
|
||||||
|
p:
|
||||||
|
$ref: '#'
|
||||||
|
o:
|
||||||
|
$ref: '#'
|
||||||
required:
|
required:
|
||||||
- v
|
- t
|
||||||
- e
|
examples:
|
||||||
example:
|
- description: IRI term
|
||||||
v: http://schema.org/name
|
value:
|
||||||
e: true
|
t: i
|
||||||
|
i: http://schema.org/name
|
||||||
|
- description: Literal term
|
||||||
|
value:
|
||||||
|
t: l
|
||||||
|
v: John Doe
|
||||||
|
- description: Literal with language tag
|
||||||
|
value:
|
||||||
|
t: l
|
||||||
|
v: Bonjour
|
||||||
|
l: fr
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
type: object
|
type: object
|
||||||
description: |
|
description: |
|
||||||
RDF triple representing a subject-predicate-object statement in the knowledge graph.
|
RDF triple representing a subject-predicate-object statement in the knowledge graph,
|
||||||
|
optionally scoped to a named graph.
|
||||||
|
|
||||||
Example: (Person1) -[has name]-> ("John Doe")
|
Example: (Person1) -[has name]-> ("John Doe")
|
||||||
properties:
|
properties:
|
||||||
|
|
@ -13,17 +14,26 @@ properties:
|
||||||
o:
|
o:
|
||||||
$ref: './RdfValue.yaml'
|
$ref: './RdfValue.yaml'
|
||||||
description: Object - the value or target entity
|
description: Object - the value or target entity
|
||||||
|
g:
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
Named graph URI (optional). When absent, the triple is in the default graph.
|
||||||
|
Well-known graphs:
|
||||||
|
- (empty/absent): Core knowledge facts
|
||||||
|
- urn:graph:source: Extraction provenance
|
||||||
|
- urn:graph:retrieval: Query-time explainability
|
||||||
|
example: urn:graph:source
|
||||||
required:
|
required:
|
||||||
- s
|
- s
|
||||||
- p
|
- p
|
||||||
- o
|
- o
|
||||||
example:
|
example:
|
||||||
s:
|
s:
|
||||||
v: http://example.com/Person1
|
t: i
|
||||||
e: true
|
i: http://example.com/Person1
|
||||||
p:
|
p:
|
||||||
v: http://schema.org/name
|
t: i
|
||||||
e: true
|
i: http://schema.org/name
|
||||||
o:
|
o:
|
||||||
|
t: l
|
||||||
v: John Doe
|
v: John Doe
|
||||||
e: false
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,22 @@
|
||||||
type: object
|
type: object
|
||||||
description: Document embeddings query response
|
description: Document embeddings query response with matching chunks and similarity scores
|
||||||
properties:
|
properties:
|
||||||
chunks:
|
chunks:
|
||||||
type: array
|
type: array
|
||||||
description: Similar document chunks (text strings)
|
description: Matching document chunks with similarity scores
|
||||||
items:
|
items:
|
||||||
type: string
|
type: object
|
||||||
|
properties:
|
||||||
|
chunk_id:
|
||||||
|
type: string
|
||||||
|
description: Chunk identifier URI
|
||||||
|
example: "urn:trustgraph:chunk:abc123"
|
||||||
|
score:
|
||||||
|
type: number
|
||||||
|
description: Similarity score (higher is more similar)
|
||||||
|
example: 0.89
|
||||||
example:
|
example:
|
||||||
- "Quantum computing uses quantum mechanics principles for computation..."
|
- chunk_id: "urn:trustgraph:chunk:abc123"
|
||||||
- "Neural networks are computing systems inspired by biological neurons..."
|
score: 0.95
|
||||||
- "Machine learning algorithms learn patterns from data..."
|
- chunk_id: "urn:trustgraph:chunk:def456"
|
||||||
|
score: 0.82
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,21 @@
|
||||||
type: object
|
type: object
|
||||||
description: Graph embeddings query response
|
description: Graph embeddings query response with matching entities and similarity scores
|
||||||
properties:
|
properties:
|
||||||
entities:
|
entities:
|
||||||
type: array
|
type: array
|
||||||
description: Similar entities (RDF values)
|
description: Matching graph entities with similarity scores
|
||||||
items:
|
items:
|
||||||
$ref: '../../common/RdfValue.yaml'
|
type: object
|
||||||
|
properties:
|
||||||
|
entity:
|
||||||
|
$ref: '../../common/RdfValue.yaml'
|
||||||
|
description: Matching graph entity
|
||||||
|
score:
|
||||||
|
type: number
|
||||||
|
description: Similarity score (higher is more similar)
|
||||||
|
example: 0.92
|
||||||
example:
|
example:
|
||||||
- {v: "https://example.com/person/alice", e: true}
|
- entity: {t: i, i: "https://example.com/person/alice"}
|
||||||
- {v: "https://example.com/person/bob", e: true}
|
score: 0.95
|
||||||
- {v: "https://example.com/concept/quantum", e: true}
|
- entity: {t: i, i: "https://example.com/concept/quantum"}
|
||||||
|
score: 0.82
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,23 @@ properties:
|
||||||
description: Collection to query
|
description: Collection to query
|
||||||
default: default
|
default: default
|
||||||
example: research
|
example: research
|
||||||
|
g:
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
Named graph filter (optional).
|
||||||
|
- Omitted/null: all graphs
|
||||||
|
- Empty string: default graph only
|
||||||
|
- URI string: specific named graph (e.g., urn:graph:source, urn:graph:retrieval)
|
||||||
|
example: urn:graph:source
|
||||||
|
streaming:
|
||||||
|
type: boolean
|
||||||
|
description: Enable streaming response delivery
|
||||||
|
default: false
|
||||||
|
example: true
|
||||||
|
batch-size:
|
||||||
|
type: integer
|
||||||
|
description: Number of triples per streaming batch
|
||||||
|
default: 20
|
||||||
|
minimum: 1
|
||||||
|
maximum: 1000
|
||||||
|
example: 50
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,31 @@
|
||||||
type: object
|
type: object
|
||||||
description: Document RAG response
|
description: Document RAG response message
|
||||||
properties:
|
properties:
|
||||||
|
message_type:
|
||||||
|
type: string
|
||||||
|
description: Type of message - "chunk" for LLM response chunks, "explain" for explainability events
|
||||||
|
enum: [chunk, explain]
|
||||||
|
example: chunk
|
||||||
response:
|
response:
|
||||||
type: string
|
type: string
|
||||||
description: Generated response based on retrieved documents
|
description: Generated response text (for chunk messages)
|
||||||
example: The research papers found three key findings...
|
example: Based on the policy documents, customers can return items within 30 days...
|
||||||
|
explain_id:
|
||||||
|
type: string
|
||||||
|
description: Explainability node URI (for explain messages)
|
||||||
|
example: urn:trustgraph:question:abc123
|
||||||
|
explain_graph:
|
||||||
|
type: string
|
||||||
|
description: Named graph containing the explainability data
|
||||||
|
example: urn:graph:retrieval
|
||||||
end-of-stream:
|
end-of-stream:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Indicates streaming is complete (streaming mode)
|
description: Indicates LLM response stream is complete
|
||||||
|
default: false
|
||||||
|
example: true
|
||||||
|
end_of_session:
|
||||||
|
type: boolean
|
||||||
|
description: Indicates entire session is complete (all messages sent)
|
||||||
default: false
|
default: false
|
||||||
example: true
|
example: true
|
||||||
error:
|
error:
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,21 @@ description: Graph RAG response message
|
||||||
properties:
|
properties:
|
||||||
message_type:
|
message_type:
|
||||||
type: string
|
type: string
|
||||||
description: Type of message - "chunk" for LLM response chunks, "provenance" for provenance announcements
|
description: Type of message - "chunk" for LLM response chunks, "explain" for explainability events
|
||||||
enum: [chunk, provenance]
|
enum: [chunk, explain]
|
||||||
example: chunk
|
example: chunk
|
||||||
response:
|
response:
|
||||||
type: string
|
type: string
|
||||||
description: Generated response text (for chunk messages)
|
description: Generated response text (for chunk messages)
|
||||||
example: Quantum physics and computer science intersect in quantum computing...
|
example: Quantum physics and computer science intersect in quantum computing...
|
||||||
provenance_id:
|
explain_id:
|
||||||
type: string
|
type: string
|
||||||
description: Provenance node URI (for provenance messages)
|
description: Explainability node URI (for explain messages)
|
||||||
example: urn:trustgraph:session:abc123
|
example: urn:trustgraph:question:abc123
|
||||||
|
explain_graph:
|
||||||
|
type: string
|
||||||
|
description: Named graph containing the explainability data
|
||||||
|
example: urn:graph:retrieval
|
||||||
end_of_stream:
|
end_of_stream:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: Indicates LLM response stream is complete
|
description: Indicates LLM response stream is complete
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ openapi: 3.1.0
|
||||||
|
|
||||||
info:
|
info:
|
||||||
title: TrustGraph API Gateway
|
title: TrustGraph API Gateway
|
||||||
version: "1.8"
|
version: "2.1"
|
||||||
description: |
|
description: |
|
||||||
REST API for TrustGraph - an AI-powered knowledge graph and RAG system.
|
REST API for TrustGraph - an AI-powered knowledge graph and RAG system.
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ info:
|
||||||
Require running flow instance, accessed via `/api/v1/flow/{flow}/service/{kind}`:
|
Require running flow instance, accessed via `/api/v1/flow/{flow}/service/{kind}`:
|
||||||
- AI services: agent, text-completion, prompt, RAG (document/graph)
|
- AI services: agent, text-completion, prompt, RAG (document/graph)
|
||||||
- Embeddings: embeddings, graph-embeddings, document-embeddings
|
- Embeddings: embeddings, graph-embeddings, document-embeddings
|
||||||
- Query: triples, objects, nlp-query, structured-query
|
- Query: triples, rows, nlp-query, structured-query, row-embeddings
|
||||||
- Data loading: text-load, document-load
|
- Data loading: text-load, document-load
|
||||||
- Utilities: mcp-tool, structured-diag
|
- Utilities: mcp-tool, structured-diag
|
||||||
|
|
||||||
|
|
@ -140,6 +140,10 @@ paths:
|
||||||
/api/v1/flow/{flow}/service/document-load:
|
/api/v1/flow/{flow}/service/document-load:
|
||||||
$ref: './paths/flow/document-load.yaml'
|
$ref: './paths/flow/document-load.yaml'
|
||||||
|
|
||||||
|
# Document streaming
|
||||||
|
/api/v1/document-stream:
|
||||||
|
$ref: './paths/document-stream.yaml'
|
||||||
|
|
||||||
# Import/Export endpoints
|
# Import/Export endpoints
|
||||||
/api/v1/import-core:
|
/api/v1/import-core:
|
||||||
$ref: './paths/import-core.yaml'
|
$ref: './paths/import-core.yaml'
|
||||||
|
|
|
||||||
53
specs/api/paths/document-stream.yaml
Normal file
53
specs/api/paths/document-stream.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Import/Export
|
||||||
|
summary: Stream document content from library
|
||||||
|
description: |
|
||||||
|
Streams the raw content of a document stored in the library.
|
||||||
|
Returns the document content in chunked transfer encoding.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- `user`: User identifier (required)
|
||||||
|
- `document-id`: Document IRI to retrieve (required)
|
||||||
|
- `chunk-size`: Size of each response chunk in bytes (optional, default: 1MB)
|
||||||
|
|
||||||
|
operationId: documentStream
|
||||||
|
security:
|
||||||
|
- bearerAuth: []
|
||||||
|
parameters:
|
||||||
|
- name: user
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: User identifier
|
||||||
|
example: trustgraph
|
||||||
|
- name: document-id
|
||||||
|
in: query
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Document IRI to retrieve
|
||||||
|
example: "urn:trustgraph:doc:abc123"
|
||||||
|
- name: chunk-size
|
||||||
|
in: query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
default: 1048576
|
||||||
|
description: Chunk size in bytes (default 1MB)
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Document content streamed as raw bytes
|
||||||
|
content:
|
||||||
|
application/octet-stream:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: binary
|
||||||
|
'400':
|
||||||
|
description: Missing required parameters
|
||||||
|
'401':
|
||||||
|
$ref: '../components/responses/Unauthorized.yaml'
|
||||||
|
'500':
|
||||||
|
$ref: '../components/responses/Error.yaml'
|
||||||
|
|
@ -2,7 +2,7 @@ asyncapi: 3.0.0
|
||||||
|
|
||||||
info:
|
info:
|
||||||
title: TrustGraph WebSocket API
|
title: TrustGraph WebSocket API
|
||||||
version: "1.8"
|
version: "2.1"
|
||||||
description: |
|
description: |
|
||||||
WebSocket API for TrustGraph - providing multiplexed, asynchronous access to all services.
|
WebSocket API for TrustGraph - providing multiplexed, asynchronous access to all services.
|
||||||
|
|
||||||
|
|
@ -31,7 +31,7 @@ info:
|
||||||
**Flow-Hosted Services** (require `flow` parameter):
|
**Flow-Hosted Services** (require `flow` parameter):
|
||||||
- agent, text-completion, prompt, document-rag, graph-rag
|
- agent, text-completion, prompt, document-rag, graph-rag
|
||||||
- embeddings, graph-embeddings, document-embeddings
|
- embeddings, graph-embeddings, document-embeddings
|
||||||
- triples, objects, nlp-query, structured-query, structured-diag
|
- triples, rows, nlp-query, structured-query, structured-diag, row-embeddings
|
||||||
- text-load, document-load, mcp-tool
|
- text-load, document-load, mcp-tool
|
||||||
|
|
||||||
## Schema Reuse
|
## Schema Reuse
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue