Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kotob for nodejs

これはNodejsで動作する、Gemini APIを使用した翻訳クライアントです。 API KeyはGoogle Cloud Platformで取得できます。

対応環境

  • Node.js v18以上
  • npm v8以上

インストール

npm install @kotob/translate

使い方

import { Kotob } from "@kotob/translate";
const kotob = new Kotob({
  key: 'YOUR_API_KEY',
});

(async () => {
  const result = await kotob.translate('Hello, world!', 'en', 'ja');
  console.log(result); // こんにちは、世界!(LLM翻訳ゆえに差異が出る可能性があります)
})();

API

translate(text: string, sourceLang: string, targetLang: string): Promise<string>

テキストを翻訳します。

  • text: 翻訳するテキスト
  • sourceLang: 元の言語コード(例: 'en', 指定されなかった場合、自動で推測されます)
  • targetLang: 翻訳先の言語コード(例: 'ja', 指定されなかった場合、自動で推測されます)

ドキュメント

APIの詳細なドキュメントはこちらをご覧ください。

ライセンス

ISC License

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages