搜索插件、代码仓与 APP 分类

GitHub 代码仓Azzeccagarbugli/openai_client

openai_client

一个非官方的、跨平台的客户端,用于访问由 OpenAI 开发的不同 AI 模型

openai_client 项目封面
星标
40
复刻
13
最近推送(UTC)
2024年5月4日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

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.

Francesco Coppola GitHub avatar
GitHub 作者

Francesco Coppola ↗

An atypical Italian developer that doesn't like coffee and enjoys pineapple pizza

Eindhoven
语言Dart

分类

此仓库发布的插件

使用的依赖

依赖清单 6 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗