1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[ODC]生成AI(GitHub Copilot)を使って、External Logicを作成してみる

Posted at

では、Geminiを使って簡単なExternal Logicを作れそうなことを確認した。
トライアルを申し込んだので、GitHub Copilotを使ったらどんなことができそうか探ってみたい。

この記事では、ドキュメントのURLを渡してプロジェクトやinterfaceの生成を依頼するとどうなるかをみていく。

以下のようなやり取りをしてみた感想としては、お任せで作ってもらうのは難しそう。現状のGitHub Copilotでは、開発者が必要なことをきちんと理解した上で、プロンプトの工夫と、生成後の修正は必要そうに見える。

環境情報

OutSystemsExternalLibraries.SDK.1.5.0
.NET SDK 8.0
Visual Studio Code (Version 1.96.0)
生成AIはGitHub CopilotをExtension(V1.252.0)経由で使用

作業はMac OSで実施

SDK READMEページのURLを渡してプロジェクト作成を依頼してみる

プロンプト

以下のURLを読んで、この書き方に則ったC#のプロジェクトを作ることは可能ですか? https://success.outsystems.com/documentation/outsystems_developer_cloud/building_apps/extend_your_apps_with_external_logic_using_custom_code/external_libraries_sdk_readme/

回答

はい、OutSystemsのExternal Libraries SDKのガイドラインに従ってC#プロジェクトを作成することは可能です。以下はその手順です。

続いて、プロジェクトの作成コマンド・OutSystems提供ライブラリのインストールコマンド・クラスサンプル・ビルドコマンド・アップロード方法が出力された。

しかし、以下の問題があった。大まかな流れはあっているが、出力された結果をそのままつかうことは到底できそうにない。プロンプトの工夫が必要そう。

OutSystems提供ライブラリのインストールコマンドが間違っている

コマンドは以下だが、指定バージョンが1.0.0。この記事を書いている段階では最新が1.5.0。External Logic機能のリリース時は確か1.4.0。Copilotに提供した記事中では、ExternalLibraries.SDKのバージョン指定については記述がなかったためだろうか。それなら、バージョン指定なしにしてくれれば良いのだが。

dotnet add package OutSystems.ExternalLibraries.SDK --version 1.0.0

実装の不足

提供された実装コードは以下の通り。

  1. ドキュメントには記述があるinterfaceの提供がない
  2. using部分は属性を提供するものなので、classファイルには不要だが、なぜかついている(→C#の知識が足りていない?)
.cs
using OutSystems.ExternalLibraries.SDK;

namespace MyOutSystemsLibrary
{
    public class ExternalLibrary : IExternalLibrary
    {
        public string Execute(string input)
        {
            // Your custom logic here
            return $"Processed: {input}";
        }
    }
}

ビルドコマンドの間違い?

提供されたビルドコマンドは以下。

dotnet build

ドキュメントによると、以下のコマンドが提示されている(シンプルなプロジェクトならlinux-x64は省略できそうだが、コマンドはどうせコピーして貼り付けるか履歴から呼び出すので省略する必要もない)。

dotnet publish -c Release -r linux-x64 --no-self-contained

アップロード方法の間違い

これはあまりにも違う。ドキュメントにちゃんと書いてあるんだけどどうしてこうなるのか。

  • ODCなのにService Studioと言っている(Service Studioにアップロードとは一体何だろう)
  • そもそもアップロード先はIDEではなく管理用コンソール
  • zipしなければいけないが言及なし
OutSystemsにDLLをアップロード:
生成されたDLLをOutSystemsのService Studioにアップロードし、アクションを定義します。

不足しているinterface作成を依頼する

プロンプト

そのドキュメントによると、Interfaceとそのメンバーには決まった属性をつけなければいけません。上の3で作ったclassで実装するinterfaceを作成してください。

回答

得られたinterface定義は以下。interface定義は出力されたが問題がある。

.cs
using OutSystems.ExternalLibraries.SDK;
using OutSystems.ExternalLibraries.SDK.Attributes;

namespace MyOutSystemsLibrary
{
    [ExternalLibrary("MyOutSystemsLibrary", "1.0.0")]
    public interface IExternalLibrary
    {
        [ExternalFunction("Execute", Description = "Executes custom logic with the provided input.")]
        string Execute(string input);
    }
}

問題点

  • 「using OutSystems.ExternalLibraries.SDK.Attributes;」
    • AttributesというnamespaceはOutSystems.ExternalLibraries.SDKにはなさそうなのにusingで指定されている。幻覚か?
  • 「[ExternalLibrary("MyOutSystemsLibrary", "1.0.0")]」
    • プロパティ名指定は必要そうなので、プロパティ指定していないこの方法は間違い
    • バージョン番号と思われる"1.0.0"を指定できるプロパティはOSInterfaceにはない
    • そもそも属性名ExternalLibraryが間違いであり、OSInterfaceとするところ
  • 「[ExternalFunction("Execute", Description = "Executes custom logic with the provided input.")]」
    • プロパティ名指定は必要そうなので、プロパティ指定していないこの方法は間違い
    • ExternalFunctionではなくOSAction

属性名の間違いを指摘し、修正を依頼してみる

プロンプト

interfaceにつける属性はOSInterface、メソッドにつけるのはOSActionです

回答(interfaceのみ抜粋)

.cs
using OutSystems.ExternalLibraries.SDK;
using OutSystems.ExternalLibraries.SDK.Attributes;

namespace MyOutSystemsLibrary
{
    [OSInterface("MyOutSystemsLibrary", "1.0.0")]
    public interface IExternalLibrary
    {
        [OSAction(Description = "Executes custom logic with the provided input.")]
        string Execute(string input);
    }
}

属性名は直ったが、ドキュメント中に列挙されている、これらの属性のプロパティは適切に使用されていない。

プロンプトで修正依頼していくのは可能そうだが、キリがないので一旦この辺で留めておく。

ドキュメント中に書かれているアップロード手順を抜き出すように依頼してみる

上では、ビルドした結果をアップロードする部分が割と出鱈目だった。
そこで、単純に提示したドキュメントから該当部分を抜粋するように依頼してみた(駄目だった……)。

プロンプト

以下のURL中に、ビルドしたExternal LogicをODCにアップロードする手順が記述されています。その部分を抜粋してください。

https://success.outsystems.com/documentation/outsystems_developer_cloud/building_apps/extend_your_apps_with_external_logic_using_custom_code/external_libraries_sdk_readme/

回答は以下の通り。

  • 日本語で質問しているのに回答が英語?
  • 相変わらずzip化する手順が抜けている
  • 抜粋して、と言っているのに、提示したURLに書いていない、External Logicの詳細なアップロード手順が返ってきている。URLを読むというより、別途持っている知識から回答していそう
  • 4でクリックするボタン名が違う
  • 6は一般のLibraryのもの
Upload the External Library to ODC
1. Build the project:
Use Visual Studio or the command line to build your project and generate the DLL file.

2. Log in to OutSystems Developer Cloud:
Access the OutSystems Developer Cloud management console and log in.

3. Navigate to the External Libraries section:
From the menu, go to the "External Libraries" section.

4. Add a new library:
Click the "Add Library" button to add a new library.

5. Upload the DLL file:
Select the built DLL file from your project and upload it.

6. Configure the library:
Provide the necessary details such as the library name, version, and description.

7. Publish the library:
Once the configuration is complete, click the "Publish" button to make the library available for use in your OutSystems applications.

感想

  • やはり、生成AIに任せきりで開発するのは無理そう
  • プロンプトと注意事項を整備して、スキルと知識のある開発者が開発効率化くらいに使うのが良さそう
  • 提示したURLはちゃんと読まれていない(もしかして全く読んでいないかも)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?