mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-01 09:29:38 +02:00
fix: linter cleanup on flow service implementations
Minor fixes from linter: readonly modifiers, unused parameter prefixes, type narrowing in graph-rag BFS traversal and edge scoring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b6536eca38
commit
0042f9259c
7 changed files with 21 additions and 19 deletions
|
|
@ -35,7 +35,7 @@ interface ConfigPush {
|
|||
export class ConfigService extends AsyncProcessor {
|
||||
private store = new Map<string, Map<string, unknown>>();
|
||||
private version = 0;
|
||||
private persistPath: string | null;
|
||||
private readonly persistPath: string | null;
|
||||
private consumer: BackendConsumer<ConfigRequest> | null = null;
|
||||
private responseProducer: BackendProducer<ConfigResponse> | null = null;
|
||||
private pushProducer: BackendProducer<ConfigPush> | null = null;
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ function topicName(name: string): string {
|
|||
// ---------- Manager ----------
|
||||
|
||||
export class DispatcherManager {
|
||||
private pubsub: PubSubBackend;
|
||||
private readonly pubsub: PubSubBackend;
|
||||
private requestors = new Map<string, RequestResponse<unknown, unknown>>();
|
||||
|
||||
constructor(private readonly config: GatewayConfig) {
|
||||
constructor(config: GatewayConfig) {
|
||||
this.pubsub = new NatsBackend(config.natsUrl ?? "nats://localhost:4222");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import { LlmService, type ProcessorConfig, type LlmResult, type LlmChunk, TooMan
|
|||
|
||||
export class ClaudeProcessor extends LlmService {
|
||||
private client: Anthropic;
|
||||
private defaultModel: string;
|
||||
private defaultTemperature: number;
|
||||
private maxOutput: number;
|
||||
private readonly defaultModel: string;
|
||||
private readonly defaultTemperature: number;
|
||||
private readonly maxOutput: number;
|
||||
|
||||
constructor(config: ProcessorConfig & {
|
||||
model?: string;
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import { LlmService, type ProcessorConfig, type LlmResult, type LlmChunk, TooMan
|
|||
|
||||
export class OpenAIProcessor extends LlmService {
|
||||
private client: OpenAI;
|
||||
private defaultModel: string;
|
||||
private defaultTemperature: number;
|
||||
private maxOutput: number;
|
||||
private readonly defaultModel: string;
|
||||
private readonly defaultTemperature: number;
|
||||
private readonly maxOutput: number;
|
||||
|
||||
constructor(config: ProcessorConfig & {
|
||||
model?: string;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export interface PromptTemplateConfig extends ProcessorConfig {
|
|||
|
||||
export class PromptTemplateService extends FlowProcessor {
|
||||
private templates = new Map<string, PromptTemplate>();
|
||||
private configKey: string;
|
||||
private readonly configKey: string;
|
||||
|
||||
constructor(config: PromptTemplateConfig) {
|
||||
super(config);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ export class DocumentRag {
|
|||
|
||||
async query(
|
||||
queryText: string,
|
||||
options?: {
|
||||
_options?: {
|
||||
collection?: string;
|
||||
streaming?: boolean;
|
||||
chunkCallback?: ChunkCallback;
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@
|
|||
*/
|
||||
|
||||
import type {
|
||||
RequestResponse,
|
||||
TextCompletionRequest,
|
||||
TextCompletionResponse,
|
||||
EmbeddingsRequest,
|
||||
EmbeddingsResponse,
|
||||
GraphEmbeddingsRequest,
|
||||
GraphEmbeddingsResponse,
|
||||
TriplesQueryRequest,
|
||||
TriplesQueryResponse,
|
||||
PromptRequest,
|
||||
PromptResponse,
|
||||
RequestResponse,
|
||||
Term,
|
||||
TextCompletionRequest,
|
||||
TextCompletionResponse,
|
||||
Triple,
|
||||
TriplesQueryRequest,
|
||||
TriplesQueryResponse,
|
||||
} from "@trustgraph/base";
|
||||
|
||||
export interface GraphRagConfig {
|
||||
|
|
@ -87,9 +87,11 @@ export class GraphRag {
|
|||
const scoredEdges = await this.scoreEdges(queryText, subgraph);
|
||||
|
||||
// Step 6: Synthesize answer
|
||||
const answer = await this.synthesize(queryText, scoredEdges, options?.chunkCallback);
|
||||
|
||||
return answer;
|
||||
return await this.synthesize(
|
||||
queryText,
|
||||
scoredEdges,
|
||||
options?.chunkCallback
|
||||
);
|
||||
}
|
||||
|
||||
private async extractConcepts(query: string): Promise<string[]> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue