1 Star 0 Fork 649

doingOne/dify

forked from Dify.AI/dify 
Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

Dify PHP SDK

This is the PHP SDK for the Dify API, which allows you to easily integrate Dify into your PHP applications.

Requirements

  • PHP 7.2 or later
  • Guzzle HTTP client library

Usage

After installing the SDK, you can use it in your project like this:

<?php

require 'vendor/autoload.php';

use YourVendorName\DifyPHP\DifyClient;
use YourVendorName\DifyPHP\CompletionClient;
use YourVendorName\DifyPHP\ChatClient;

$apiKey = 'your-api-key-here';

$difyClient = new DifyClient($apiKey);

// Create a completion client
$completionClient = new CompletionClient($apiKey);
$response = $completionClient->create_completion_message($inputs, $query, $response_mode, $user);

// Create a chat client
$chatClient = new ChatClient($apiKey);
$response = $chatClient->create_chat_message($inputs, $query, $user, $response_mode, $conversation_id);

// Fetch application parameters
$response = $difyClient->get_application_parameters($user);

// Provide feedback for a message
$response = $difyClient->message_feedback($message_id, $rating, $user);

// Other available methods:
// - get_conversation_messages()
// - get_conversations()
// - rename_conversation()

Replace 'your-api-key-here' with your actual Dify API key.

License

This SDK is released under the MIT License.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/doingOne/dify.git
git@gitee.com:doingOne/dify.git
doingOne
dify
dify
main

Search