はじめに
下記の記事にある通り、RHEL10では生成AI関連のサービスを提供するRHEL LightSpeedを使用することができるようになりました。現在は、RHEL9.6でも使用することができるようです。
今回、このLightSpeedを使ってみたく、RHEL10環境を用意しましたので、本記事ではRHEL LightSpeedの使用感を纏めてみました。
RHEL LightSpeedの準備
まずは、下記ドキュメントに従い、LightSpeedを搭載したコマンドラインアシスタントというものをRHEL10環境にインストールします。RHEL10環境を導入しただけでは、LightSpeedは使用できませんのでご注意ください。
以下のコマンドを実行し、コマンドラインアシスタントをインストールします。
[rheluser@localhost ~]$ sudo dnf install command-line-assistant
依存関係が解決しました。
================================================================================
パッケージ Arch バージョン リポジトリー サイズ
================================================================================
インストール:
command-line-assistant
noarch 0.3.1-3.el10_0 rhel-10-for-x86_64-appstream-rpms 248 k
依存関係のインストール:
command-line-assistant-selinux
noarch 0.3.1-3.el10_0 rhel-10-for-x86_64-appstream-rpms 26 k
python3-greenlet x86_64 3.0.3-5.el10 rhel-10-for-x86_64-appstream-rpms 268 k
python3-sqlalchemy
x86_64 2.0.26-6.el10 rhel-10-for-x86_64-appstream-rpms 3.6 M
python3-typing-extensions
noarch 4.9.0-6.el10 rhel-10-for-x86_64-baseos-rpms 81 k
トランザクションの概要
================================================================================
インストール 5 パッケージ
ダウンロードサイズの合計: 4.2 M
インストール後のサイズ: 24 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/5): python3-typing-extensions-4.9.0-6.el10.n 107 kB/s | 81 kB 00:00
(2/5): command-line-assistant-0.3.1-3.el10_0.no 106 kB/s | 248 kB 00:02
(3/5): python3-greenlet-3.0.3-5.el10.x86_64.rpm 87 kB/s | 268 kB 00:03
(4/5): python3-sqlalchemy-2.0.26-6.el10.x86_64. 967 kB/s | 3.6 MB 00:03
(5/5): command-line-assistant-selinux-0.3.1-3.e 12 kB/s | 26 kB 00:02
--------------------------------------------------------------------------------
合計 818 kB/s | 4.2 MB 00:05
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
準備 : 1/1
scriptletの実行中: command-line-assistant-selinux-0.3.1-3.el10_0.noarch 1/5
インストール中 : command-line-assistant-selinux-0.3.1-3.el10_0.noarch 1/5
scriptletの実行中: command-line-assistant-selinux-0.3.1-3.el10_0.noarch 1/5
インストール中 : python3-greenlet-3.0.3-5.el10.x86_64 2/5
インストール中 : python3-typing-extensions-4.9.0-6.el10.noarch 3/5
インストール中 : python3-sqlalchemy-2.0.26-6.el10.x86_64 4/5
インストール中 : command-line-assistant-0.3.1-3.el10_0.noarch 5/5
scriptletの実行中: command-line-assistant-0.3.1-3.el10_0.noarch 5/5
scriptletの実行中: command-line-assistant-selinux-0.3.1-3.el10_0.noarch 5/5
scriptletの実行中: command-line-assistant-0.3.1-3.el10_0.noarch 5/5
インストール済みの製品が更新されています。
インストール済み:
command-line-assistant-0.3.1-3.el10_0.noarch
command-line-assistant-selinux-0.3.1-3.el10_0.noarch
python3-greenlet-3.0.3-5.el10.x86_64
python3-sqlalchemy-2.0.26-6.el10.x86_64
python3-typing-extensions-4.9.0-6.el10.noarch
完了しました!
インストールが終わると、新たに「c」というコマンドが追加されます。これがコマンドラインアシスタントを実行するコマンドになりますので、準備完了です。
[rheluser@localhost ~]$ which c
/usr/bin/c
RedHat LightSpeedによる生成AI機能の使用
下記ドキュメントにも記載されていますが、ユーザーが質問を投げると、RedHat LightSpeedは、Watsonx AI API LLMを使用して回答を作成し、ユーザーに応答を返すようです。その際に使用されるLLMは、IBM Watsonx LLM IBM Graniteモデルとなっています。
コマンドラインアシスタントを使用したLightSpeedへの質問投稿
質問を投げる際には、「c "質問文"」というフォーマットで指示を与えます。今回は、お試しとして下記のようなプロンプトを実行してみました。
プロンプトその1:単純な質問
[rheluser@localhost ~]$ c "Can RHEL10 run on IBM Cloud?"
しばらくして、下記のような回答が戻ってきました。
⁺₊+ Asking RHEL Lightspeed
This feature uses AI technology. Do not include any personal information or
other sensitive information in your input. Interactions may be used to improve
Red Hat's products or services.
--------------------------------------------------------------------------------
Yes, Red Hat Enterprise Linux (RHEL) 10 can run on IBM Cloud. The kernel of RHEL is separate from the host operating system and the client system you use to connect to the instance. This means that any operating system, including RHEL 10, can be installed on a cloud instance on IBM Cloud.
On IBM Cloud, you can deploy RHEL 10 instances and run RHEL-specific applications that may not be compatible with your local operating system. The configuration of a RHEL 10 instance on IBM Cloud is controlled by software, allowing for easy creation, removal, cloning, or migration of the instance.
For more information about deploying RHEL on IBM Cloud, you can refer to the following resources:
* What is public cloud? (https://www.redhat.com/en/topics/cloud-computing/what-is-public-cloud)
* Public cloud use cases for RHEL (https://www.redhat.com/en/topics/cloud-computing/public-cloud-use-cases-for-rhel)
* Obtaining RHEL for public cloud deployments (https://www.redhat.com/en/resources/obtaining-rhel-public-cloud-deployments-brief)
To start using RHEL 10 on IBM Cloud, you can create an instance through the IBM Cloud console, selecting RHEL 10 as the operating system.
---------------------------------------------------------------------------
Always review AI-generated content prior to use.
いい感じで回答が返ってきているかと思います。
プロンプトその2:Ansible Playbookの作成依頼
[rheluser@localhost ~]$ c "Please create ansible playbook to install & start apache server."
しばらくして、下記のような回答が戻ってきました。
⁺₊+ Asking RHEL Lightspeed
---------------------------------------------------------------------------
Here's a basic Ansible playbook to install and start the Apache server on your RHEL system:
[yaml] Snippet ---------------------------------
---
- name: Install and start Apache server
hosts: your_target_hosts
become: yes
tasks:
- name: Install Apache
yum:
name: httpd
state: present
- name: Start Apache service
service:
name: httpd
state: started
enabled: yes
------------------------------------------------
Replace your_target_hosts with the hosts where you want to install and start Apache.
To use this playbook:
1. Save it to a file, for example, install_apache.yml.
2. Run the following command to validate the playbook syntax:
``bash
$ ansible-playbook --syntax-check --ask-vault-pass install_apache.yml
`
3. If the syntax is correct, run the playbook with:
`bash
$ ansible-playbook --ask-vault-pass install_apache.yml
`
This playbook will install the Apache package using yum and start the httpd service. The enabled: yes` directive ensures that the service starts automatically on boot.
Remember to adjust the playbook according to your specific requirements and environment.
---------------------------------------------------------------
Always review AI-generated content prior to use.
Playbookの内容は想定していたものとなっており、実行手順も書いてくれてます。シンタックス・チェックの手順まで返してくれたのには感動しました。世の中には、ChatGPTやGoogle Gemini、Amazon Q Developerという生成AI関連のツールがありますが、Ansible Playbookの作成に関しては本家のRedHatに聞くのが良いと思いますので、個人的にはRedHat LightSpeedを利用することをお奨めします。
対話履歴の確認
コマンドラインアシスタントを使用して会話をした履歴を表示、削除する場合には、下記リンク先のコマンドを参考ください。
最初の質問をチェックする場合
「c history --first」コマンドを実行します。以下はサンプルです。
最後の質問をチェックする場合
「c history --last」コマンドを実行します。以下はサンプルです。
いずれのケースも、QuestionとAnswerの前に顔文字が表示されているのが、愛嬌があってよいなと思います。
対話履歴を削除する場合
「c history --clear」コマンドを実行します。
[rheluser@localhost ~]$ c history --clear
Cleaning the history.
さいごに
今回は、RHEL10で使用できるようになったRHEL LightSpeed機能を試してみて、その使用感をご紹介しました。コマンドラインから質問を投稿できるというのは、使ってみて改めて便利だと思いました。コマンドラインから生成AIサービスを使用できるものとしては、AWS社からもAmazon Q Developer CLIというものが今年の4月に発表されています。こちらは現状Ubuntu Linuxではサポートされてますが、RHELは明記されていないので、稼働する保証はなさそうです。
私は、個人環境としてRHELとUbuntuの両方の環境を保有してますので、UbuntuではAmazon Q Developer CLIを、RHELではRHEL LightSpeedと2足のわらじ運用をしていこうと思います。