Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

AspireとGitHub Modelsで作るお手軽AIアプリ

AspireとGitHub Modelsで作るお手軽AIアプリ

Avatar for Yuta Matsumura

Yuta Matsumura

December 21, 2025
Tweet

More Decks by Yuta Matsumura

Other Decks in Technology

Transcript

  1. Aspire と GitHub Models で 作るお手軽 AI アプリ 2025/12/20 .NET

    Conf 2025 Fukuoka Yuta Matsumura © 2025 Yuta Matsumura. #dotnetconf #fukuten 1
  2. 松村 優大 (MLBお兄さん) © 2025 Yuta Matsumura. #dotnetconf #fukuten 株式会社オルターブース

    (Chief Technical Architect) Microsoft MVP for Developer Technologies Microsoft Top Partner Engineer Award 2025 GitHub 公認トレーナー C#, PHP, Azure, GitHub #fukuten #devblogradio #phpconfuk https://linktr.ee/tsubakimoto 2
  3. Aspire とは • aka.ms/dotnet-aspire • 観測可能で本番環境に適した分散アプリケーションを構築するための クラウド対応スタック • 特徴 1.

    オーケストレーション:複数アプリケーションの相互接続を管理 2. コンポーネント:DB や各サービスの統合 3. ツール:ダッシュボードや Visual Studio のテンプレート © 2025 Yuta Matsumura. #dotnetconf #fukuten 4
  4. Aspire 13.0 Unified infrastructure across .NET, JavaScript, and Python with

    debugging, container-deployment, auto-generated Dockerfiles Modern development experience with CLI enhancements, single-file AppHost support, and quicker onboarding Seamless build & deployment, built in static file site support, and robust deploy parallelization Enterprise-ready infrastructure & services with flexible connection strings and certificate trust across languages and containers RELEASED Aspire.dev https://github.com/dotnetConf/2025/blob/main/Technical/dotNETConf2025-Keynote.pptx
  5. © 2025 Yuta Matsumura. #dotnetconf #fukuten 6 9 から 13

    に ジャンプ https://www.nuget.org/packages/Aspire.Hosting
  6. Aspire 13 のアップデート • 「.NET Aspire」 から 「Aspire」 にリブランド •

    Python アプリのサポートの改善 • uvicorn によるデプロイ、Dockerfile の自動生成、など • JavaScript アプリのサポートの改善 • パッケージマネージャーの自動検出、コンテナーベースの Vite および npm • など © 2025 Yuta Matsumura. #dotnetconf #fukuten 9 https://aspire.dev/whats-new/aspire-13/
  7. .NET Conf の Aspire セッション • Aspire: Cloud-Native Development Simplified

    • Deep Dive: Extending and Customizing Aspire • Aspire Unplugged with David and Maddy © 2025 Yuta Matsumura. #dotnetconf #fukuten 10
  8. GitHub Models 統合 • NuGet: Aspire.Hosting.GitHub.Models • https://aspire.dev/integrations/ai/github-models/ • GitHub

    Models は PAT 認証 (Fine-grained Token ) • GitHub Models にあるモデルを IChatClient で利用できる • Aspire.Azure.AI.Inference (Microsoft.Extensions.AI) • Aspire.OpenAI (OpenAI) © 2025 Yuta Matsumura. #dotnetconf #fukuten 12 Embedding は未サポート (Issue)
  9. using Aspire . Hosting . GitHub ; var builder =

    DistributedApplication. CreateBuilder ( args ); var model = GitHubModel.OpenAI.OpenAIGpt4oMini; var chat = builder. AddGitHubModel ( " chat " , model); builder. AddProject <Projects . ChatApp >( " chatapp " ) . WithReference (chat) ; © 2025 Yuta Matsumura. #dotnetconf #fukuten 13
  10. Dev tunnels (開発トンネル) • ローカルの HTTP エンドポイントをインターネットに公開できる • 一時的または永続的なエンドポイントで公開 •

    アクセス制御可能, HTTPS プロトコルで提供 © 2025 Yuta Matsumura. #dotnetconf #fukuten 14 種類 アクセス範囲 非公開 作成者のみ 組織用 同一組織アカウントのみ (MSAやGitHubアカウントでは非公開と同じ) 公開用 認証なし
  11. Dev tunnels 統合 • NuGet: Aspire.Hosting.DevTunnels • https://aspire.dev/integrations/devtools/dev-tunnels/ • トンネル設定をコードベースで管理

    • Aspire 実行時にトンネル作成 • 外部からアクセス可能な URL が作成される (*.devtunnels.ms) © 2025 Yuta Matsumura. #dotnetconf #fukuten 15
  12. var builder = DistributedApplication. CreateBuilder ( args ); var web

    = builder. AddProject <Projects . ChatApp >( " chatapp " ); var tunnel = builder. AddDevTunnel ( " my- tunnel " ) . WithReference (web) . WithAnonymousAccess (); © 2025 Yuta Matsumura. #dotnetconf #fukuten 16
  13. Azure Cosmos DB 統合 • NuGet: Aspire.Hosting.Azure.CosmosDB • https://aspire.dev/integrations/cloud/azure/azure-cosmos-db/ •

    Azure リソース利用 or エミュレーター利用 • 従来の Windows 向けのエミュレーター • Linux ベースの vNext エミュレーター © 2025 Yuta Matsumura. #dotnetconf #fukuten 19
  14. #pragma warning disable ASPIRECOSMOSDB001 var cosmos = builder. AddAzureCosmosDB (

    " cosmos - db" ) . RunAsPreviewEmulator ( emulator => { emulator. WithDataExplorer (); }); var db = cosmos. AddCosmosDatabase ( " db " ); var container = db. AddContainer ( " chats " , " /id " ); builder. AddProject <Projects . ChatApp >( " chatapp " ) . WithReference (container) ; © 2025 Yuta Matsumura. #dotnetconf #fukuten 20
  15. string key = Environment. GetEnvironmentVariable ( " CHAT_KEY " );

    string endpoint = Environment. GetEnvironmentVariable ( " CHAT_URI " ); string deployment = Environment. GetEnvironmentVariable ( " CHAT_MODEL " ); ApiKeyCredential credential = new(key); OpenAIClientOptions openAIOptions = new() { Endpoint = new Uri (endpoint) }; IChatClient client = new OpenAIClient (credential, openAIOptions ) . GetChatClient (deployment) . AsIChatClient (); © 2025 Yuta Matsumura. #dotnetconf #fukuten 22 from Aspire
  16. string prompt = " What is the capital of Japan?

    " ; await foreach ( ChatResponseUpdate item in client. GetStreamingResponseAsync (prompt)) { Console. Write ( item.Text ); } © 2025 Yuta Matsumura. #dotnetconf #fukuten 23
  17. Agent モードの計画機能 • Agent が実行するタスクを「計画する」機能が登場 • Markdown に計画が列挙され、タスクの進捗を記録 • LLM

    向けの内容は一時ファイルの JSON で保持 • %TEMP%¥VisualStudio¥copilot-vs¥plan-xxx.json https://devblogs.microsoft.com/visualstudio/introducing-planning-in-visual-studio-public-preview/ © 2025 Yuta Matsumura. #dotnetconf #fukuten 29
  18. @test • テストを扱う Copilot エージェント • メンバー • ファイル •

    プロジェクト • ソリューション • git diff (コード変更箇所のみをテストする場合) https://devblogs.microsoft.com/dotnet/github-copilot-testing-for-dotnet/ © 2025 Yuta Matsumura. #dotnetconf #fukuten 34