This package contains a retrieval-oriented intent-to-P4LTL system.
syntax_checker/Parser-backed P4LTL syntax checker and agent-facing validation interface.context_store.pyLoads P4 sources, build artifacts, runtime JSON, and guide content into memory.context_tools.pyRead-only retrieval tools for code search, JSON queries, bounded snippet reads, and graph queries.intent_decomposer.pyStructured intent decomposition layer.context_validator.pyChecks whether referenced fields/tables/actions/keys match the aligned context.semantic_reviewer.pyHeuristic semantic review for generated specs.pipeline_protocol.pyEnd-to-endIntentToP4LTLPipelineorchestration.benchmark_specs.pyDefault benchmark catalog for Case Study and SageFuzz/P4 programs.benchmark_runner.pyRuns reference benchmark validation or a pipeline over the benchmark catalog.
Run the default reference benchmark validation:
PYTHONPATH=/home/gosh/P4LTL python3.12 /home/gosh/P4LTL/P4LTL_LLM/benchmark_runner.pyUse the pipeline from Python:
from P4LTL_LLM import IntentToP4LTLPipeline, IntentToP4LTLRequest
pipeline = IntentToP4LTLPipeline(use_agents=False)
request = IntentToP4LTLRequest(
intent="生成一个简单性质,验证 ingress_port 始终为非负",
p4_program_paths=["/abs/path/to/program.p4"],
artifact_paths=["/abs/path/to/build.json"],
guide_path="/home/gosh/P4LTL/P4LTL_LLM/P4LTL_user_guide",
)
result = pipeline.generate_and_validate(request)
print(result.model_dump_json(indent=2))Run the online Agno pipeline directly:
PYTHONPATH=/home/gosh/P4LTL python3.12 /home/gosh/P4LTL/P4LTL_LLM/agno_online_generate.py \
--intent "验证 ingress_port 为 1 的 IPv4 包最终会从端口 3 转发" \
--admin-description "Use exact fields from the program and artifacts." \
--p4 /abs/path/to/program.p4 \
--artifact /abs/path/to/build.jsonThe online model configuration is now read from:
/home/gosh/P4LTL/P4LTL_LLM/config/api_config.json
Notes:
- Online mode uses
IntentToP4LTLPipeline(use_agents=True). - By default it enables streaming model calls because the configured gateway may reject non-streaming requests.
- Pass
--no-streamonly if your backend supports non-streaming structured responses.