deepseek-1.x-dev/src/AiProvidersInterface.php

src/AiProvidersInterface.php
<?php

namespace Drupal\deepseek;

/**
 * Interface for AI providers plugins.
 */
interface AiProvidersInterface {

  /**
   * Returns a list of available models from the provider.
   *
   * @return array
   *   An associative array of available models.
   *   Example:
   *   [
   *     'gpt-3.5-turbo' => 'GPT 3.5 Turbo',
   *     'gpt-4' => 'GPT-4',
   *   ]
   */
  public function models($url = '', $api_key = ''): array;

  /**
   * Sends a prompt and receives a chat-style response.
   *
   * @param array $messages
   *   An array of messages in chat format.
   *   Example:
   *   [
   *     ['role' => 'user', 'content' => 'Hello'],
   *     ['role' => 'assistant', 'content' => 'Hi, how can I help you?'],
   *   ].
   * @param array $options
   *   (optional) Additional options such as model, temperature, etc.
   *   Example:
   *   [
   *     'model' => 'gpt-4',
   *     'temperature' => 0.7,
   *   ].
   * @param array $files
   *   File to upload.
   *
   * @return array
   *   Response with message content and metadata.
   */
  public function chat(array $messages, array $options = [], array $files = []);

  /**
   * Sends a raw text prompt for single-shot completions (not chat).
   *
   * @param string $prompt
   *   The input prompt string.
   * @param array $options
   *   (optional) Additional options (model, temperature, max_tokens, etc).
   *
   * @return array
   *   The completion result.
   */
  public function completions(string $prompt, array $options = []);

  /**
   * Generates embeddings from a given text or list of texts.
   *
   * @param string $input
   *   A string of strings to embed.
   * @param array $options
   *   (optional) Additional options (model, dimensions, etc).
   *
   * @return array
   *   The embedding vectors.
   *   Example: [
   *     [0] => 0.041395925,
   *     [1] => -0.017692696,
   *   ]
   */
  public function embeddings(string $input, array $options = []);

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc