このプロジェクトをサポートするために、お気軽にコーヒーを購入してください。
Soupyは、ローカルイメージジェネレーター(フラックス)および/またはDall-E 3で画像を生成できるDiscordのチャットボットです。チャットには、JSon、ChatGPT、およびローカル検索エンジンの組み合わせを使用して、ユーザーと会話します。ユーザーのチャットメッセージのインデックスを作成し、それらのメッセージを使用してユーザーのプロファイルを作成します。また、アクセスできるサーバー上のすべてのチャネルにインデックスを付けます。
スープには複数のバージョンがあります。
Soupyには、ChatGPTモデルへのOpenAI APIアクセスが必要です。したがって、Soupyのチャット部分には本当のお金が使用されます。 Dall-E 3の画像生成もそうです。 Dall-E 3世代をスキップし、ローカルでフラックスのみを使用できます。
サーバーからのチャネル履歴がダウンロードされ、インデックス化され、サーバー上のすべてのユーザーがChatGPTのAPIを介してお金をかけているプロファイルを使用する最初のセットアップがあります。いつか私は地元のLLMSもサポートしますが、まだそうではありません。
フラックスを機能させるために、公式フラックスリポジトリからここから始めることを強くお勧めします。ただし、フルクアップアンドランニングを行うと、このリポジトリに含まれるsoupy-gradio.pyを使用できます。
!flux (ローカル画像モデル)、! !generate (dall-e 3)、! !analyze (chatgpt)、および!transform (chatgpt)など、さまざまなクールなアクションを実行するなど、さまざまな驚くべきコマンドがあります。.envのBEHAVIOUR変数でこれを行います。しかし、あなたがそれをどのように変えるかに注意してください。その言葉遣いは、スープをオントラックに保つために重要です。 Soupyをセットアップする前に、システムに次のインストールがあることを確認してください。
スープリポジトリをローカルマシンにクローニングすることから始めます。
git clone https://github.com/sneezeparty/soupy.git
cd soupy
仮想環境を使用して依存関係を管理することをお勧めします。
python -m venv soupy
仮想環境を有効にします:
MacOSとLinuxについて:
source soupy/bin/activate
Windows:
soupyScriptsactivate
pipを使用して、必要なPythonパッケージをインストールします。
pip install -r requirements.txt
プロジェクトのルートディレクトリに.envファイルを作成し、必要な環境変数を入力します。
DISCORD_TOKEN=your_discord_bot_token
OPENAI_API_KEY=your_openai_api_key
CHANNEL_IDS=00,11
MAX_TOKENS=2500
MAX_TOKENS_RANDOM=75
MODEL_CHAT=gpt-4o-mini
UPDATE_INTERVAL_MINUTES=61
TRANSFORM="You give detailed and accurate descriptions, be specific in whatever ways you can, such as but not limited to colors, species, poses, orientations, objects, and contexts."
BEHAVIOUR="You are Soupy Dafoe, a sarcastic and witty Discord chatbot. You recall past interactions and conversations to inform your responses. Your replies are concise, straightforward, and infused with a bit of sarcasm, much like Jules from "Pulp Fiction." You are not overly positive and avoid asking questions unless necessary. Prioritize the most recent five messages when formulating your responses, especially if not directly mentioned. If the latest message is brief, focus your reply accordingly and consider ignoring extensive chat history. Integrate the user's profile information subtly to tailor your responses without making it the main focus. Be conversational, stay in the moment, and avoid being too random or wordy. Remember, you're kind of a jerk, but in a human-like way."
Soupyは、アクセスできるすべてのチャネルにアクセスできることに注意してください。ただし、上記のチャネル内のすべてのメッセージに応答します。それ以外の場合は、ランダムにのみ応答するか、@Taggedの場合にのみ応答します。
スクリプト内で、「/absolute/directory/of/your/script/」を検索し、これをスクリプトの場所の絶対ディレクトリに置き換えます。
Apache Solrは、メッセージとユーザープロファイルのインデックス作成と検索に使用されます。これらの手順に従って、SOLRのインストールと構成をスープにします。
Solrをダウンロード:Apache Solr Webサイトにアクセスして、最新のStableリリースをダウンロードしてください。一部のパッケージマネージャーを使用することもできます。ディストリビューションの情報をご覧ください。
パッケージを抽出します
SOLRをサービスとしてインストールする:このプロセスの正確な手順に関するドキュメントをフォローしてください。しかし、それは難しくありません。あなたはそれをすることができます。
インストールの確認:
ブラウザを開き、 http://localhost:8983/solrに移動して、solr管理インターフェイスにアクセスします。
SOUPYには、ユーザープロファイルを効果的にインデックス化するために、特定のフィールドを備えた単一のSOLRコアが必要です。
bin/solr create -c soupy
必要なフィールドをsoupy Coreに追加して、ユーザープロファイルを保存します。
アクセスSOLR管理インターフェイス:
http://localhost:8983/solrに移動し、 soupy Coreを選択します。
フィールドの定義:
curl -X POST -H 'Content-type:application/json'
http://localhost:8983/solr/soupy/schema
-d '{
"add-field": {
"name": "id",
"type": "string",
"indexed": true,
"stored": true,
"required": true,
"multiValued": false
}
}'
またはこれ
curl -X POST -H "Content-Type: application/json"
"http://localhost:8983/solr/soupy/schema"
-d '{
"add-field":{
"name":"user_problems",
"type":"text_general",
"indexed":true,
"stored":true
}
}'
必要なフィールドをsoupy Coreに追加して、ユーザープロファイルとチャネル情報を保存します。
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="username" type="string" indexed="true" stored="true"/>
<field name="nicknames" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="join_date" type="date" indexed="true" stored="true"/>
<field name="political_party" type="string" indexed="true" stored="true"/>
<field name="user_job_career" type="text_general" indexed="true" stored="true"/>
<field name="user_family_friends" type="text_general" indexed="true" stored="true"/>
<field name="user_activities" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_games" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_movies" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_music" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_television" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_life" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_food" type="text_general" indexed="true" stored="true"/>
<field name="general_opinions" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_politics" type="text_general" indexed="true" stored="true"/>
<field name="personality_traits" type="text_general" indexed="true" stored="true"/>
<field name="hobbies" type="text_general" indexed="true" stored="true"/>
<field name="user_interests" type="text_general" indexed="true" stored="true"/>
<field name="user_problems" type="text_general" indexed="true" stored="true"/>
<field name="tech_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_technology" type="text_general" indexed="true" stored="true"/>
<field name="sports_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_sports" type="text_general" indexed="true" stored="true"/>
<field name="book_preferences" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_books" type="text_general" indexed="true" stored="true"/>
<field name="art_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_art" type="text_general" indexed="true" stored="true"/>
<field name="health_concerns" type="text_general" indexed="true" stored="true"/>
<field name="health_habits" type="text_general" indexed="true" stored="true"/>
<field name="science_interests" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_science" type="text_general" indexed="true" stored="true"/>
<field name="travel_preferences" type="text_general" indexed="true" stored="true"/>
<field name="travel_experiences" type="text_general" indexed="true" stored="true"/>
<field name="food_preferences" type="text_general" indexed="true" stored="true"/>
<field name="opinions_about_food" type="text_general" indexed="true" stored="true"/>
<field name="last_updated" type="date" indexed="true" stored="true"/>
<field name="channel_id" type="string" indexed="true" stored="true" required="true" multiValued="false"/>
<field name="username" type="string" indexed="true" stored="true"/>
<field name="content" type="text_general" indexed="true" stored="true"/>
<field name="timestamp" type="pdate" indexed="true" stored="true"/>
変更のコミット:
すべてのフィールドを追加した後、変更をコミットしてそれらを効果的にします。
インストールと構成の手順を完了したら、次のコマンドを使用してボットを起動できます。サーバーのアクティビティとユーザー数に応じて、最初の実行には時間がかかります。数分または数時間かかる場合があります。端子出力は、それが何をしているかを教えてくれます。
python soupy-solr.py
または
python soupy-flux.py
そして
python gradio-soupy.py
仮想環境と、 soupyがある正しいディレクトリにいることを確認してください。
gradio-soupy.pyは、フラックス用のグラデーションベースのバックエンドです。ブラウザを介してこれにアクセスすることもできます。
!fluxさまざまな修飾子とインタラクティブボタンをサポートしてフラックスモデルを使用して画像を生成して、さらにカスタマイズします。
そして、 - ファンシーモディファイア、または「書き換え」ボタンなど:
修飾子:
--wide :幅の広い画像(1920x1024)を生成します。--tall :背の高い画像(1024x1920)を生成します。--small :小さな画像(512x512)を生成します。--fancy :より創造的で詳細になるようにプロンプトを詳しく説明します。これは、API経由でChatGPTの使用を使用します。--seed <number> :画像生成に特定のシードを使用します。使用法:
!flux A mystical forest with glowing plants --tall
!fluxコマンドで画像を生成した後、Soupyはさらにカスタマイズするためのインタラクティブなボタンを提供します。
Remix :新しいランダムシードを使用して、既存のプロンプトに基づいて新しい画像を生成します。Rewrite :創造性と詳細を高めるためにプロンプトを詳しく説明します。これは、ChatGPTのAPIを使用します( --fancyモディファイアと同じ)。Wide :画像の寸法をワイド形式に調整します。Tall :画像の寸法を背の高い形式に調整します。 !generateオプションの修飾子を持つテキストプロンプトに基づいて、Dall-E 3を使用して画像を生成します。これはまもなく非推奨かもしれません。
修飾子:
--wide :幅の広い画像(1920x1024)を生成します。--tall :背の高い画像(1024x1920)を生成します。使用法:
!generate A futuristic city skyline at sunset --wide
!analyze画像内のテキストの翻訳やオブジェクトとその属性の識別など、提供された指示に基づいて添付の画像を分析します。
使用法:
!analyze Identify all the animals in this image.
!analyze Describe this image forensically.
このコマンドを使用するときに画像を添付します。
!8ballマジック8ボールに質問してください。 LLMまたはMLを使用しません。
使用法:
!8ball Will I get an A on my exam?
!whattime指定された都市で現在の時間を取得して表示します。
使用法:
!whattime New York
このプロジェクトは、MITライセンスの下でライセンスされています。
MITライセンスCopyright(c)2024 Sneezeparty
このソフトウェアと関連するドキュメントファイル(「ソフトウェア」)のコピーを入手して、制限なしにソフトウェアを扱うために、このソフトウェアのコピーを使用、修正、公開、配布、サブライセンス、および/またはソフトウェアのコピーを承認する条件に承認するソフトウェアが承認するソフトウェアに承認するソフトウェアのすべてのコピーまたはかなりの部分。
このソフトウェアは、商品性、特定の目的への適合性、および非侵害の保証を含むがこれらに限定されない、明示的または黙示的なものを保証することなく、「現状のまま」提供されます。いかなる場合でも、著者または著作権所有者は、契約、不法行為、またはその他の訴訟、ソフトウェアまたはソフトウェアの使用またはその他の取引に関連する、またはその他の契約、またはその他の請求、またはその他の責任について責任を負いません。
問題が発生したり、質問がある場合は、リポジトリのGitHub問題セクションで問題を公開してください。
このプロジェクトをサポートするためにコーヒーを買ってください。