File size: 1,579 Bytes
c2ea5ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Platform-Specific Trace Parsers

This module provides rule-based parsers for extracting structured metadata 
from traces originating from different AI observability platforms.

These parsers complement the multi-agent knowledge extractor by providing
platform-specific structural information that every trace from that platform
will contain, helping to improve extraction accuracy and completeness.

Architecture:
- base_parser.py: Base parser interface and common functionality
- langsmith_parser.py: LangSmith-specific trace structure parsing
- langfuse_parser.py: Langfuse-specific trace structure parsing (future)
- parser_factory.py: Factory for selecting appropriate parser based on trace source

Usage:
    from agentgraph.input.parsers import create_parser, detect_trace_source
    
    # Detect source and create appropriate parser
    source = detect_trace_source(trace_content, trace_metadata)
    parser = create_parser(source)
    
    # Extract platform-specific metadata
    parsed_metadata = parser.parse_trace(trace_content, trace_metadata)
"""

from .base_parser import BaseTraceParser, ParsedMetadata
from .langsmith_parser import LangSmithParser
from .parser_factory import create_parser, detect_trace_source, get_context_documents_for_source, parse_trace_with_context
from .universal_parser import GenericLangSmithParser

__all__ = [
    'BaseTraceParser',
    'ParsedMetadata', 
    'LangSmithParser',
    'GenericLangSmithParser',
    'create_parser',
    'detect_trace_source',
    'get_context_documents_for_source',
    'parse_trace_with_context'
]