Quarantined
This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.
Azure LangChain Example
一个用于 Azure OpenAI 与 LangChain 集成的最小 Python 项目示例。
这个项目依赖官方的
langchain-openai包;它提供AzureChatOpenAI、AzureOpenAI和AzureOpenAIEmbeddings等 Azure OpenAI 封装。
安装
pip install azure-langchain-example
若尚未发布到 PyPI,可在项目根目录执行:
pip install -e .
配置
先在 Azure OpenAI 中创建模型部署,然后设置环境变量:
export AZURE_OPENAI_API_KEY="your-api-key"
export AZURE_OPENAI_ENDPOINT="https://your-resource-name.openai.azure.com/"
使用 Azure OpenAI 聊天模型
from langchain_openai import AzureChatOpenAI
llm = AzureChatOpenAI(
azure_deployment="your-deployment-name",
api_version="2024-05-01-preview",
temperature=0,
)
response = llm.invoke("用一句话解释什么是 RAG。")
print(response.content)
azure_deployment 是 Azure 门户中创建的部署名称,可能与底层模型名称不同。
发布
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload --repository testpypi dist/*
确认测试安装无误后,上传正式 PyPI:
python -m twine upload dist/*
每次发布都必须增加 pyproject.toml 中的 version;PyPI 不允许覆盖已上传的版本。
License
MIT
Release files for azure-langchain-example 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| azure_langchain_example-0.1.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azure_langchain_example-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.2 kB
Release files / azure_langchain_example-0.1.0.tar.gz
| Download URL | azure_langchain_example-0.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b579b3c91692bc05fef6b96ea9499c738f9fd4135a477c8c4edc0e15aec0bc5
|
|
BLAKE2b-256 checksum How to use checksums |
ab07e73d3ec1041bb6e05e0660d8503e8ebe1f3f9440a893a89699c671d136a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / azure_langchain_example-0.1.0-py3-none-any.whl
| Download URL | azure_langchain_example-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4108d947939529d4ed630b623a2a4c4051c4bb70620fe25df7817fd025e1be38
|
|
BLAKE2b-256 checksum How to use checksums |
fda88ec8f05648e5acce828b1acaf317a0428fc8cfc5fa6bf91a5f22c77223e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|