承接 adrienbrault/hermes2pro 相关项目开发

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

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

adrienbrault/hermes2pro

Composer 安装命令:

composer require adrienbrault/hermes2pro

包简介

README 文档

README

NousResearch/Hermes-2-Pro-Mistral-7B is an open source LLM with great function calling capabilities.

This PSR-18 plugin converts OpenAI API requests/responses that use function calling to and from the Hermes2Pro prompt format.

It lets you use Hermes2Pro function calling with the same OpenAI api client code that you currently use.

An http proxy docker image is available for non PHP projects.

PHP Library

Install ollama (docker) and pull the model:

$ ollama pull adrienbrault/nous-hermes2pro:Q4_K_M

Install this package:

$ composer require adrienbrault/hermes2pro:@dev

Then update your code to use the plugin:

use AdrienBrault\Hermes2Pro\Hermes2ProPlugin;
use Http\Client\Common\PluginClient;
use Http\Discovery\Psr18ClientDiscovery;

require_once __DIR__ . '/vendor/autoload.php';

$client = OpenAI::factory()
    ->withApiKey(getenv('OPENAI_API_KEY'))
    ->withBaseUri(sprintf(
        '%s/v1',
        getenv('OLLAMA_HOST') ?: 'http://localhost:11434'
    ))
    ->withHttpClient(
        new PluginClient(
            Psr18ClientDiscovery::find(),
            [
                new Hermes2ProPlugin()
            ]
        )
    )
    ->make()
;

Then use adrienbrault/nous-hermes2pro:Q4_K_M as the model in your chat requests. There are more tags/quantizations available.

The model and this plugin supports parallel function calling. Note that streaming is not currently supported.

Note that the plugin is only active if the request/response model starts with adrienbrault/nous-hermes2pro.

See demo/.

Docker Proxy

A docker http proxy is available to convert requests/responses to/from the Hermes2Pro format:

$ docker run -it --rm \
    -e OPENAI_BASE_URI=http://docker.for.mac.host.internal:11434 \
    -p 11440:80 \
    adrienbrault/hermes2pro-proxy

$ MODEL="adrienbrault/nous-hermes2pro:Q4_K_M" \
    OPENAI_BASE_URI="http://localhost:11440/v1" \
    php demo/openai.php

统计信息

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

GitHub 信息

  • Stars: 18
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-28