mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-23 20:21:03 +02:00
Remove cruft
This commit is contained in:
parent
c81d952f9f
commit
ce72069065
1 changed files with 0 additions and 51 deletions
|
|
@ -1,51 +0,0 @@
|
|||
"""
|
||||
Debug script to understand StreamingReActParser behavior
|
||||
"""
|
||||
import sys
|
||||
sys.path.insert(0, '/home/mark/work/trustgraph.ai/trustgraph/trustgraph-flow')
|
||||
|
||||
from trustgraph.agent.react.streaming_parser import StreamingReActParser
|
||||
|
||||
# Test the parser with different chunking strategies
|
||||
full_text = """Thought: I need to search for information about machine learning.
|
||||
Action: knowledge_query
|
||||
Args: {
|
||||
"question": "What is machine learning?"
|
||||
}"""
|
||||
|
||||
print("=" * 60)
|
||||
print("TEST 1: Send as single chunk")
|
||||
print("=" * 60)
|
||||
|
||||
parser1 = StreamingReActParser()
|
||||
parser1.feed(full_text)
|
||||
parser1.finalize()
|
||||
result1 = parser1.get_result()
|
||||
print(f"Result: {result1}")
|
||||
print(f"Action name: '{result1.name}'")
|
||||
print(f"Arguments: {result1.arguments}")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("TEST 2: Send line-by-line chunks")
|
||||
print("=" * 60)
|
||||
|
||||
parser2 = StreamingReActParser()
|
||||
chunks = [
|
||||
"Thought: I need to search for information about machine learning.\n",
|
||||
"Action: knowledge_query\n",
|
||||
"Args: {\n",
|
||||
' "question": "What is machine learning?"\n',
|
||||
"}"
|
||||
]
|
||||
|
||||
for i, chunk in enumerate(chunks):
|
||||
print(f"\nChunk {i}: {repr(chunk)}")
|
||||
print(f" Before: state={parser2.state}, action_buffer='{parser2.action_buffer}'")
|
||||
parser2.feed(chunk)
|
||||
print(f" After: state={parser2.state}, action_buffer='{parser2.action_buffer}'")
|
||||
|
||||
parser2.finalize()
|
||||
result2 = parser2.get_result()
|
||||
print(f"\nFinal Result: {result2}")
|
||||
print(f"Action name: '{result2.name}'")
|
||||
print(f"Arguments: {result2.arguments}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue