Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

README.md 1.3KB

il y a 2 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Dify PHP SDK
  2. This is the PHP SDK for the Dify API, which allows you to easily integrate Dify into your PHP applications.
  3. ## Requirements
  4. - PHP 7.2 or later
  5. - Guzzle HTTP client library
  6. ## Usage
  7. After installing the SDK, you can use it in your project like this:
  8. ```
  9. <?php
  10. require 'vendor/autoload.php';
  11. use YourVendorName\DifyPHP\DifyClient;
  12. use YourVendorName\DifyPHP\CompletionClient;
  13. use YourVendorName\DifyPHP\ChatClient;
  14. $apiKey = 'your-api-key-here';
  15. $difyClient = new DifyClient($apiKey);
  16. // Create a completion client
  17. $completionClient = new CompletionClient($apiKey);
  18. $response = $completionClient->create_completion_message($inputs, $query, $response_mode, $user);
  19. // Create a chat client
  20. $chatClient = new ChatClient($apiKey);
  21. $response = $chatClient->create_chat_message($inputs, $query, $user, $response_mode, $conversation_id);
  22. // Fetch application parameters
  23. $response = $difyClient->get_application_parameters($user);
  24. // Provide feedback for a message
  25. $response = $difyClient->message_feedback($message_id, $rating, $user);
  26. // Other available methods:
  27. // - get_conversation_messages()
  28. // - get_conversations()
  29. // - rename_conversation()
  30. ```
  31. Replace 'your-api-key-here' with your actual Dify API key.
  32. ## License
  33. This SDK is released under the MIT License.