cohere-chat-ui / README.md
Nyanfa's picture
Add Contributor credit
089ea35 verified
metadata
title: Cohere Chat UI
emoji: 🌍
colorFrom: blue
colorTo: gray
sdk: streamlit
sdk_version: 1.33.0
app_file: app.py
pinned: false
license: apache-2.0

Avatar size Contributor: ★31 >>538

English & 日本語

User Guide for Cohere Chat UI

This application provides an interactive chat interface using Cohere's chat models. The following is an explanation of the main features and how to use the application.

  1. Entering the API Key

    • Enter your Cohere API key in the text box.
    • You can obtain your API key from here: https://dashboard.cohere.com/api-keys
    • Once the API key is entered correctly, the application will become available for use.
  2. Using the Chat

    • Type your message in the chat input box and submit it to receive a response from the Cohere model.
    • The chat history is displayed on the page, with user and Cohere model messages alternating.
  3. Editing, Deleting, and Retrying Messages

    • Below each message, there are "Edit", "Delete", and "Retry" buttons.
    • Clicking the "Edit" button displays a text area where you can edit the content of the message. After making changes, click the "Save" button to save your edits, or click the "Cancel" button to discard the changes.
    • Clicking the "Delete" button removes the corresponding message from the chat history.
    • Clicking the "Retry" button, which appears only for the last message from the AI, allows you to regenerate the AI's response. This is useful if you want to get a different or updated response without modifying the input message.
  4. Copying Messages

    • Below each message, there is a "Copy" button.
    • Clicking the "Copy" button copies the content of the message to your clipboard.
    • The button text temporarily changes to "Copied!" to indicate that the message has been successfully copied.
  5. Copying the Conversation Log

    • Clicking the "Copy Conversation History" button in the sidebar copies the entire current conversation log to your clipboard.
    • The button text temporarily changes to "Copied!" to confirm that the conversation history has been copied successfully.
    • This makes it easy to save or share the conversation log.
  6. Advanced Settings

    • In the sidebar, there is an "Advanced Settings" section where you can adjust the model parameters.
    • The "Model" dropdown allows you to select the Cohere model to use.
    • The "Preamble" text area enables you to input any preamble information to provide to the model.
    • The "Temperature" slider adjusts the randomness of the model's output. Higher values result in more random output.
    • The "Top-K" slider allows you to set the number of most likely tokens to consider for generation at each step. Increasing the value considers more diverse tokens but may result in less relevant generated text.
    • The "Top-P" slider allows you to set the cumulative probability threshold for the most likely tokens to consider for generation at each step. Lower values focus on more probable tokens and reduce the diversity of the generated text. If both "Top-K" and "Top-P" are enabled, "Top-P" acts after "Top-K".
    • The "Penalty Type" and "Penalty Value" allow you to set penalties based on the frequency or presence of words in the model's output.
  7. Restoring Conversation History

    • In the "Restore History" section of the sidebar, you can restore a previous conversation by pasting a copied conversation log.
    • Paste the conversation log into the text area and click the "Restore History" button to restore the chat history.
  8. Clearing Chat History

    • In the "Clear History" section of the sidebar, there is a "Clear Chat History" button.
    • Clicking this button clears the current chat history.
  9. Changing the API Key

    • In the "Change API Key" section of the sidebar, you can enter a new API key and click the "Update API Key" button to update the API key.
    • If the API key is successfully updated, a success message will be displayed.

By using these features, you can seamlessly interact with Cohere's chat models, with the ability to edit, delete, copy, and restore chat history, as well as adjust model parameters to customize the behavior of the chat. The application also provides management functions such as changing the API key and clearing the chat history.

Cohere Chat UIの使用説明書

このアプリケーションは、Cohereのチャットモデルを使用して対話型のチャットインターフェースを提供します。以下は、アプリケーションの主要な機能と使用方法の説明です。

  1. API キーの入力

    • テキストボックスにCohere APIキーを入力してください。
    • ここからAPIキーを入手してください: https://dashboard.cohere.com/api-keys
    • APIキーが正しく入力されると、アプリケーションが使用可能になります。
  2. チャットの使用

    • チャット入力ボックスにメッセージを入力し、送信するとCohereモデルからの応答が表示されます。
    • チャットの履歴はページ上に表示され、ユーザーとCohereモデルのメッセージが交互に表示されます。
  3. メッセージの編集、削除、リトライ

    • 各メッセージの下には、「Edit」、「Delete」、「Retry」のボタンがあります。
    • 「Edit」ボタンをクリックすると、メッセージの内容を編集できるテキストエリアが表示されます。変更を加えた後、「Save」ボタンをクリックして編集を保存するか、「Cancel」ボタンをクリックして変更を破棄します。
    • 「Delete」ボタンをクリックすると、対応するメッセージがチャットの履歴から削除されます。
    • 「Retry」ボタンは、AIからの最後のメッセージにのみ表示されます。このボタンをクリックすると、AIの応答を再生成できます。これは、入力メッセージを変更せずに、別の応答や更新された応答を取得したい場合に便利です。
  4. メッセージのコピー

    • 各メッセージの下には、「Copy」ボタンがあります。
    • 「Copy」ボタンをクリックすると、メッセージの内容がクリップボードにコピーされます。
    • ボタンのテキストは一時的に「Copied!」に変更され、メッセージが正常にコピーされたことを示します。
  5. 会話ログのコピー

    • サイドバーの「Copy Conversation History」ボタンをクリックすると、現在の会話ログ全体がクリップボードにコピーされます。
    • ボタンのテキストは一時的に「Copied!」に変更され、会話履歴が正常にコピーされたことを確認します。
    • これにより、会話ログを簡単に保存したり共有したりできます。
  6. 高度な設定

    • サイドバーには、モデルのパラメータを調整するための「Advanced Settings」セクションがあります。
    • 「Model」ドロップダウンでは、使用するCohereモデルを選択できます。
    • 「Preamble」テキストエリアでは、モデルに与えるシステムプロンプトを入力できます。
    • 「Temperature」スライダーでは、モデルの出力のランダム性を調整できます。値が高いほどランダムな出力になります。
    • 「Top-K」スライダーでは、各ステップで生成される可能性が高いトークンの数を設定できます。値を大きくすると、より多様なトークンが考慮されますが、生成されるテキストの関連性が低くなる可能性があります。
    • 「Top-P」スライダーでは、各ステップで生成される可能性が高いトークンの累積確率を設定できます。値が小さいほど、より確率の高いトークンに集中し、生成されるテキストの多様性が低くなります。「Top-K」と「Top-P」の両方が有効な場合、「Top-P」は「Top-K」の後に適用されます。
    • 「Penalty Type」と「Penalty Value」では、モデルの出力における単語の頻度やプレゼンスに基づくペナルティを設定できます。
  7. 会話履歴の復元

    • サイドバーの「Restore History」セクションでは、以前にコピーした会話ログを貼り付けることで、過去の会話を復元できます。
    • テキストエリアに会話ログを貼り付け、「Restore History」ボタンをクリックすると、チャットの履歴が復元されます。
  8. チャット履歴のクリア

    • サイドバーの「Clear History」セクションには、「Clear Chat History」ボタンがあります。
    • このボタンをクリックすると、現在のチャットの履歴がクリアされます。
  9. APIキーの変更

    • サイドバーの「Change API Key」セクションでは、新しいAPIキーを入力し、「Update API Key」ボタンをクリックすることで、APIキーを更新できます。
    • APIキーが正常に更新された場合は、成功メッセージが表示されます。

これらの機能を使用して、Cohereのチャットモデルとシームレスにインタラクションできます。チャットの履歴の編集、削除、コピー、復元が可能で、モデルのパラメータを調整することでチャットの動作をカスタマイズできます。また、APIキーの変更やチャット履歴のクリアなどの管理機能も提供されています。これらの機能を使用して、Cohereのチャットモデルとシームレスにインタラクションできます。チャットの履歴の編集、削除、コピー、復元が可能で、モデルのパラメータを調整することでチャットの動作をカスタマイズできます。