承接 gawrys/counterparty-ai 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gawrys/counterparty-ai

Composer 安装命令:

composer require gawrys/counterparty-ai

包简介

Optional AI-assisted risk research subsystem for counterparty-verification. Advisory only; never decides hard pass/fail.

README 文档

README

Packagist Version Total Downloads CI PHP PHPStan Psalm License

Optional AI-assisted risk research for the Counterparty Verification toolkit. It plugs into the same RiskStrategy seam as the rule-based default and adds qualitative, advisory context using an LLM with native tool use.

⚠️ The AI never decides hard pass/fail. It consumes the finished verification report as ground truth, grounds every claim in a tool's source URL (no source → inconclusive), and forces human review below a confidence threshold. Output is advisory only.

A separate package on purpose: prompts change often and must not bump the core's version.

Features

  • AiRiskStrategy - a drop-in RiskStrategy; PSR-16 cached by counterparty + report + prompt version to bound cost.
  • Native tool use (function calling) - the model invokes registry_lookup, web_search and verification_report; the provider executes them and feeds results back, looping until the findings JSON is returned.
  • Two reference providers over PSR-18, no SDK - AnthropicResearchProvider, OpenAiResearchProvider. Adding another LLM is one AbstractAiResearchProvider subclass.
  • Structured output, validated - force JSON, parse, validate, retry; malformed output is never trusted.
  • Deterministic test kit - FakeAiResearchProvider, recorded cassettes and an in-memory PSR-16 cache, so tests run offline.

Installation

composer require gawrys/counterparty-ai

Usage

use Gawrys\Counterparty\Ai\AiRiskStrategy;
use Gawrys\Counterparty\Ai\Prompt\RiskPromptBuilder;
use Gawrys\Counterparty\Ai\Research\AnthropicResearchProvider; // or OpenAiResearchProvider
use Gawrys\Counterparty\Ai\Tool\{RegistryTool, ReportLookupTool};

$strategy = new AiRiskStrategy(
    provider: new AnthropicResearchProvider($http, $apiKey),
    promptBuilder: new RiskPromptBuilder(),
    tools: [new RegistryTool($registries), new ReportLookupTool()],
    cache: $psr16Cache,
    reviewThreshold: 0.6,
);

$verifier = new Verifier($checks, $strategy, $clock);

Switching LLM is a one-line change (OpenAiResearchProvider), or implement AbstractAiResearchProvider::complete() for any other backend. Removing this package never breaks the rule-based default - the core has no dependency on it.

See the documentation for prompts, grounding rules and writing custom tools.

Testing

composer check

Changelog

See CHANGELOG.md.

Contributing & Security

Pull requests welcome. Report security issues privately - see SECURITY.md.

Credits

License

The MIT License (MIT). See LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 2
  • 推荐数: 2

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固