mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Add docstrings to public classes (#812)
Add class-level docstrings to five public classes in trustgraph-base: Flow, LlmService, ConsumerMetrics, ToolClient, and TriplesStoreService. Each docstring summarises the class's role in the system to aid discoverability for new contributors. Signed-off-by: Jenkins, Kenneth Alexander <kjenkins60@gatech.edu>
This commit is contained in:
parent
2f64ffc99d
commit
fdb52a6bfc
5 changed files with 32 additions and 0 deletions
|
|
@ -2,6 +2,13 @@
|
|||
import asyncio
|
||||
|
||||
class Flow:
|
||||
"""
|
||||
Runtime representation of a deployed flow process.
|
||||
|
||||
This class maintains internal processor states and orchestrates
|
||||
lifecycles (start, stop) for inputs (consumers) and parameters
|
||||
that drive data flowing across linked nodes.
|
||||
"""
|
||||
def __init__(self, id, flow, processor, defn):
|
||||
|
||||
self.id = id
|
||||
|
|
|
|||
|
|
@ -42,6 +42,12 @@ class LlmChunk:
|
|||
__slots__ = ["text", "in_token", "out_token", "model", "is_final"]
|
||||
|
||||
class LlmService(FlowProcessor):
|
||||
"""
|
||||
Extensible service processing requests to Large Language Models (LLMs).
|
||||
|
||||
This class handles the core logic of dispatching text completion or chat requests
|
||||
to integrated underlying LLM providers (e.g. OpenAI, vertex ai).
|
||||
"""
|
||||
|
||||
def __init__(self, **params):
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@ from prometheus_client import start_http_server, Info, Enum, Histogram
|
|||
from prometheus_client import Counter
|
||||
|
||||
class ConsumerMetrics:
|
||||
"""
|
||||
Metrics tracking and reporting for flow consumers.
|
||||
|
||||
This class manages prometheus metrics specifically related to consumers
|
||||
within the flow, including state, requests, processing time, and queues.
|
||||
"""
|
||||
|
||||
def __init__(self, processor, flow, name):
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@ from . request_response_spec import RequestResponse, RequestResponseSpec
|
|||
from .. schema import ToolRequest, ToolResponse
|
||||
|
||||
class ToolClient(RequestResponse):
|
||||
"""
|
||||
Client for invoking tools over the flow messaging fabric.
|
||||
|
||||
This class provides an interface to abstract away the messaging mechanics
|
||||
and provides a direct awaitable mechanism for invoking tools and
|
||||
getting their responses.
|
||||
"""
|
||||
|
||||
async def invoke(self, name, parameters={}, timeout=600):
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@ logger = logging.getLogger(__name__)
|
|||
default_ident = "triples-write"
|
||||
|
||||
class TriplesStoreService(FlowProcessor):
|
||||
"""
|
||||
Component for maintaining the triples store.
|
||||
|
||||
This service acts as a processor in the flow that receives knowledge triples
|
||||
and writes them persistently into an overarching graph database or equivalent backend.
|
||||
"""
|
||||
|
||||
def __init__(self, **params):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue