KO
|
EN
gitlite — search
Search
#javascript
#python
#hacktoberfest
#react
#ai
#typescript
#llm
#go
#golang
#android
#machine-learning
#rust
#deep-learning
#linux
dspy-demo
★ 12
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
HollywoodEditor
:
An updated tool for safely editing Hollywood Animal save files.
videostil
:
videostil extracts and deduplicates video frames, converting videos into LLM-friendly formats that fit within context windows.
claude-keep
:
Lightweight, intelligent project memory for Claude Code
qprimer_designer
:
Design tool for highly performant qPCR diagnostics.
IIINavbar
:
一个简单的收藏或展示页 https://iiistudio.github.io/IIINavbar/
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
dspy-demo
?
Download (.md)
# DSPy Demo ## セットアップ手順 ### 1. 依存関係のインストール ```bash uv sync ``` ### 2. 環境変数の設定 `.env` ファイルを作成し、Azure OpenAIまたはOpenAIの設定を行います: ```bash cp .env.example .env # .env を編集して設定を記入 ``` #### Azure OpenAIの場合 ```env PROVIDER_NAME=azure AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/ AZURE_OPENAI_API_KEY=your-api-key-here AZURE_OPENAI_API_VERSION=2025-04-01-preview ``` #### OpenAIの場合 ```env PROVIDER_NAME=openai OPENAI_API_KEY=your-api-key-here ``` ### 3. marimoの起動 ```bash uv run marimo edit notebooks/01_chatbot/01_before_tuning.py ``` ## ディレクトリ構成 ``` dspy-demo/ ├── common/ # 共通モジュール │ ├── config.py # LM設定(Azure/OpenAI切り替え) │ ├── model_saver.py # モデル保存(タイムスタンプ付き) │ └── embeddings_cache.py # 埋め込みベクトルキャッシュ ├── notebooks/ # marimoノートブック │ ├── 01_chatbot/ # チャットボットデモ │ └── 02_rag/ # RAGシステムデモ ├── data/ # データセット └── .env.example # 環境変数テンプレート ``` ## デモの紹介 ### 01_chatbot - チャットボットデモ ```bash # 1. 最適化前の動作確認 uv run marimo edit notebooks/01_chatbot/01_before_tuning.py # 2. 最適化実行(数分〜数十分かかります) uv run marimo edit notebooks/01_chatbot/02_tuning.py # 3. 最適化後の比較 uv run marimo edit notebooks/01_chatbot/03_after_tuning.py ``` ### 02_rag - RAGシステムデモ ```bash # 1. 最適化前の動作確認 uv run marimo edit notebooks/02_rag/01_before_tuning.py # 2. 最適化実行(数分〜数十分かかります) uv run marimo edit notebooks/02_rag/02_tuning.py # 3. 最適化後の比較 uv run marimo edit notebooks/02_rag/03_after_tuning.py ``` ## 使用例 ### config.pyの使用 ```python from common.config import configure_lm import dspy # LMを設定してDSPyに登録 lm = configure_lm(model_name="gpt-4.1-nano", temperature=0.7) dspy.configure(lm=lm) # 使用例 class SimpleQA(dspy.Signature): question: str = dspy.InputField() answer: str = dspy.OutputField() qa = dspy.Predict(SimpleQA) response = qa(question="DSPyはどのようなフレームワークですか?") print(response.answer) ``` ## 品質チェック ### Lintの実行 ```bash uv run ruff check . ``` ### 型チェックの実行 ```bash uv run mypy . ``` ## 参考資料 - [DSPy公式ドキュメント](https://dspy.ai/) - [DSPy GitHub](https://github.com/stanfordnlp/dspy) - [marimo公式ドキュメント](https://marimo.io/)