搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.7

openai_client

一個非官方的、跨平台的客戶端,用於存取 OpenAI 所開發的不同 AI 模型。

AndroidiOSmacOSWindowsLinux
近 30 天下載
101
喜歡數
49
Pub 分數
140

安裝套件

flutter pub add openai_client

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

openai_client 套件是一個非官方、跨平台的 Dart 客戶端,可用於與 OpenAI 的 AI 模型互動。它讓開發者能將生成式 AI 功能(例如文字產生與聊天回應)整合至 Android、iOS、macOS、Windows 及 Linux 上的 Flutter 應用程式中。此客戶端設計簡潔且具彈性,支援多種 OpenAI 端點,無需撰寫平台特定程式碼。客戶端抽象了 HTTP 互動,讓使用 API 金鑰進行驗證及傳送請求變得輕鬆簡單。非常適合用來建構跨平台應用中的 AI 功能。

適用情境

  • 將聊天機器人整合到行動和桌面應用程式中
  • 使用GPT模型產生內容
  • 使用自然語言處理構建人工智慧助手
  • 啟用即時文字補全
  • 建立多語言翻譯工具

主要特色

  • 跨平台相容性
  • OpenAI 接口的簡單 API
  • 透過 API 金鑰支援驗證
  • 非同步請求處理
  • 輕量且易於整合

適合對象

  • Flutter 開發人員建構 AI 驅動的應用程式
  • 需要多平台人工智慧整合的團隊
  • 需要生成文本功能的項目
  • 快速原型化AI功能
  • 同時面向行動和桌面用戶的App

使用建議

  • 非官方客戶端——在 OpenAI API 更新後可能需要更新
  • 需要對 API 條碼進行妥善管理
  • 依賴穩定的互聯網連接
  • 僅限OpenAI的可用模型
  • 不適用於高頻率或關鍵任務型人工智慧工作負載

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

alt Banner of the openai_client project

The OpenAI API can be applied to virtually any task that involves understanding or generating natural language or code. They 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.

ℹ️ Info

This is an unofficial client, written purely in Dart that allows you to easily use the API in your Dart or Flutter projects.

APIs Dart class Implementation status
Models OpenAIModels ✅
Completions OpenAICompletions ✅
Chat OpenAIChat ✅
Edits OpenAIEdits ✅
Images OpenAIImages ✅
Embeddings OpenAIEmbeddings ✅
Files Not present ❌
Fine-tunes Not present ❌
Moderations OpenAIModerations ✅

🧰 Installation

You can install the package by adding it to your pubspec.yaml file.

dependencies:
  openai_client: last_version

After the installation you would just need to import the package in your project.

import 'package:openai_client/openai_client.dart';

🚀 Getting Started

In order to use the API, you need to have an API key. You can get one here and once you have it, you can use it in the client passing the key itself in the OpenAIConfiguration constructor.

// Create the configuration
final conf = OpenAIConfiguration(
    apiKey: 'Your API key',
    organizationId: 'Your organization ID', // Optional
);

// Create a new client
final client = OpenAIClient(configuration: conf);

🐛 Debugging

For testing and debugging purposes, you can use the built-in Logger to more easily check the status of requests and responses.

By default, the Logger is disabled. You can enable it by setting the enableLogging property to true.

// The instance of the client with the logger enabled
final client = OpenAIClient(
    ...
    enableLogging: true,
);

🎯 Examples

The provided example is a simple command line application that allows you to test the client. You can find it in the example folder.

📚 Documentation

The full documentation of the project is available here. All the methods are documented, and you can easily check the parameters that you can pass to them.

🤝 Contributing

If you want to contribute to openai_client, please make sure to review the contribution guidelines.

This project makes use of GitHub issues for tracking requests and bugs only, so please don't use issues for general questions and discussion.

🪪 License

This project is licensed under the BSD-3-Clause.

Furthermore, it's not affiliated with OpenAI in any way.

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。