Skip to main content

Langfarm

langfarm 是 LLM 应用程序开发的工具集,增加 LLM 应用开发的便利。

Tongyi 集成 Langfuse

准备:本地安装部署 Langfuse

请参考:Langfuse 快速开始

使用 Langchain 的 Callback

使用示例

import time

from dotenv import load_dotenv
from langchain_community.llms import Tongyi
from langfarm.hooks.langfuse.callback import CallbackHandler

# 加载 .env 配置
load_dotenv()

llm = Tongyi(model="qwen-plus")
langfuse_handler = CallbackHandler()

query = '请用50个字描写春天的景色。'
result = llm.invoke(query, config={"callbacks": [langfuse_handler]})

print(result)
print("等待 5 秒,等待 langfuse 异步上报。")
time.sleep(5)
print("完成!")

然后打开 langfuse 界面查看,http://localhost:3000/

Metadata

Release files for langfarm 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langfarm 0.1.0
File Size Uploaded Provenance Actions
langfarm-0.1.0.tar.gz 3.1 kB Without provenance Details for langfarm-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langfarm 0.1.0
File Interpreter ABI Platform Actions
langfarm-0.1.0-py3-none-any.whl Python 3 none any Details for langfarm-0.1.0-py3-none-any.whl

Total release size: 7.0 kB

Release files / langfarm-0.1.0.tar.gz

Download URL langfarm-0.1.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8292489f979b8ce18672e731908c62d77975ad38c9f673cb4cab8cd9d6ff2034
BLAKE2b-256 checksum
How to use checksums
a327147f3ebdaa45eb5c13120266748199550db4a9da604de7ae190197e78761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/23.2.0

Release files / langfarm-0.1.0-py3-none-any.whl

Download URL langfarm-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9d0d54d63bc66688dda8af9e4ac76dbcdac054ccfbe7b51f45fe65d661b3336
BLAKE2b-256 checksum
How to use checksums
999e944a0a6db88bfb5431ed84be2a1f57619dc10125a3d117433685440e9581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/23.2.0

Security for langfarm 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page