speakeasy-sdks/openai-php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

speakeasy-sdks/openai-php-sdk

Composer 安装命令:

composer require speakeasy-sdks/openai-php-sdk

包简介

README 文档

README

OpenAI_Logo_Black OpenAI_Logo_White

This is an unofficial SDK for the OpenAI API. The OpenAI API can be applied to virtually any task that involves understanding or generating natural language or code. We offer a spectrum of models with different levels of power suitable for different tasks, as well as the ability to fine-tune your own custom models. These models can be used for everything from content generation to semantic search and classification.

SDK Installation

Composer

composer require "speakeasy-sdks/openai-php-sdk"

Authentication

The OpenAI API uses API keys for authentication. Visit your API Keys page to retrieve the API key you'll use in your requests.

Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps). Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service.

All API requests should include your API key in an Authorization HTTP header as follows:

Authorization: Bearer YOUR_API_KEY

SDK Example Usage

SDK Available Operations

openAI

  • cancelFineTune - Immediately cancel a fine-tune job.

  • createAnswer - Answers the specified question using the provided documents and examples.

The endpoint first searches over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for completion.

  • createChatCompletion - Creates a completion for the chat message
  • createClassification - Classifies the specified query using provided examples.

The endpoint first searches over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the completions endpoint.

Labeled examples can be provided via an uploaded file, or explicitly listed in the request using the examples parameter for quick tests and small scale use cases.

  • createCompletion - Creates a completion for the provided prompt and parameters

  • createEdit - Creates a new edit for the provided input, instruction, and parameters.

  • createEmbedding - Creates an embedding vector representing the input text.

  • createFile - Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.

  • createFineTune - Creates a job that fine-tunes a specified model from a given dataset.

Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.

Learn more about Fine-tuning

  • createImage - Creates an image given a prompt.
  • createImageEdit - Creates an edited or extended image given an original image and a prompt.
  • createImageVariation - Creates a variation of a given image.
  • createModeration - Classifies if text violates OpenAI's Content Policy
  • createSearch - The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them.

To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When file is set, the search endpoint searches over all the documents in the given file and returns up to the max_rerank number of documents. These documents will be returned along with their search scores.

The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.

  • createTranscription - Transcribes audio into the input language.

  • createTranslation - Translates audio into into English.

  • deleteFile - Delete a file.

  • deleteModel - Delete a fine-tuned model. You must have the Owner role in your organization.

  • downloadFile - Returns the contents of the specified file

  • listEngines - Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.

  • listFiles - Returns a list of files that belong to the user's organization.

  • listFineTuneEvents - Get fine-grained status updates for a fine-tune job.

  • listFineTunes - List your organization's fine-tuning jobs

  • listModels - Lists the currently available models, and provides basic information about each one such as the owner and availability.

  • retrieveEngine - Retrieves a model instance, providing basic information about it such as the owner and availability.

  • retrieveFile - Returns information about a specific file.

  • retrieveFineTune - Gets info about the fine-tune job.

Learn more about Fine-tuning

  • retrieveModel - Retrieves a model instance, providing basic information about the model such as the owner and permissioning.

SDK Generated by Speakeasy

speakeasy-sdks/openai-php-sdk 适用场景与选型建议

speakeasy-sdks/openai-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 speakeasy-sdks/openai-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 speakeasy-sdks/openai-php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 speakeasy-sdks/openai-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-22