https://github.com/yeongseon/azure-functions-knowledge-python
Knowledge retrieval (RAG) decorators for Azure Functions Python v2 — Part of the Azure Functions Python DX Toolkit
https://github.com/yeongseon/azure-functions-knowledge-python
azure azure-functions dx-toolkit knowledge notion python rag serverless
Last synced: 11 days ago
JSON representation
Knowledge retrieval (RAG) decorators for Azure Functions Python v2 — Part of the Azure Functions Python DX Toolkit
- Host: GitHub
- URL: https://github.com/yeongseon/azure-functions-knowledge-python
- Owner: yeongseon
- License: mit
- Created: 2026-04-08T14:59:23.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-05-13T07:34:46.000Z (about 1 month ago)
- Last Synced: 2026-05-13T09:32:32.721Z (about 1 month ago)
- Topics: azure, azure-functions, dx-toolkit, knowledge, notion, python, rag, serverless
- Language: Python
- Homepage: https://yeongseon.github.io/azure-functions-knowledge-python/
- Size: 649 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.ja.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Support: SUPPORT.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# azure-functions-knowledge-python
[](https://github.com/yeongseon/azure-functions-knowledge-python/actions/workflows/ci-test.yml)
[](https://badge.fury.io/py/azure-functions-knowledge-python)
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
Azure Functions Python v2向けのナレッジ検索(RAG)デコレーターです。
他の言語で読む: [English](README.md) | [한국어](README.ko.md) | [简体中文](README.zh-CN.md)
## 機能
- **デコレーターベースのAPI** — Azure Functions Python v2プログラミングモデルとのシームレスな統合
- **プロバイダー抽象化** — プロトコルベースのインターフェースによるプラガブルなナレッジプロバイダー
- **Notion対応** — ページの検索・取得のための組み込みNotionプロバイダー
- **非同期サポート** — ノンブロッキング実行のための自動非同期オフローディング
- **環境変数解決** — 安全な認証情報処理のための `%VAR%` プレースホルダー置換
## インストール
```bash
pip install azure-functions-knowledge-python[notion]
```
## クイックスタート
```python
import azure.functions as func
from azure_functions_knowledge import Document, KnowledgeBindings
app = func.FunctionApp()
kb = KnowledgeBindings()
@app.route(route="search", methods=["GET"])
@kb.input(
"docs",
provider="notion",
query=lambda req: req.params.get("q", ""),
top=5,
connection="%NOTION_TOKEN%",
)
def search(req: func.HttpRequest, docs: list[Document]) -> func.HttpResponse:
import json
results = [{"title": d.title, "url": d.url} for d in docs]
return func.HttpResponse(json.dumps(results), mimetype="application/json")
```
## デコレーター
### `input` — データインジェクション
ナレッジプロバイダーを検索し、結果をハンドラーに注入します:
```python
@kb.input("docs", provider="notion", query="roadmap", connection="%NOTION_TOKEN%")
def handler(timer, docs: list[Document]) -> None:
for doc in docs:
print(doc.title, doc.url)
```
### `inject_client` — クライアントインジェクション
命令的な制御のためにプロバイダーインスタンスを注入します:
```python
@kb.inject_client("client", provider="notion", connection="%NOTION_TOKEN%")
def handler(req, client) -> func.HttpResponse:
doc = client.get_document(page_id)
results = client.search("query", top=10)
...
```
## カスタムプロバイダー
`KnowledgeProvider` プロトコルを実装して登録します:
```python
from azure_functions_knowledge import Document, register_provider
class MyProvider:
def __init__(self, *, connection, **kwargs):
...
def search(self, query: str, *, top: int = 5) -> list[Document]:
...
def get_document(self, document_id: str) -> Document:
...
def close(self) -> None:
...
register_provider("my-provider", MyProvider)
```
## ドキュメント
完全なドキュメント: [https://yeongseon.github.io/azure-functions-knowledge-python/](https://yeongseon.github.io/azure-functions-knowledge-python/)
## ライセンス
MIT License。詳細は [LICENSE](LICENSE) を参照してください。