Friendli AI
FriendliAI enhances AI application performance and optimizes cost savings with scalable, efficient deployment options, tailored for high-demand AI workloads.
安装与设置
安装 friendli-client Python 包。
pip install -U langchain_community friendli-client
登录到 Friendli Suite 创建个人访问令牌,
并将其设置为 FRIENDLI_TOKEN 环境变量。
聊天模型
查看一个 使用示例。
from langchain_community.chat_models.friendli import ChatFriendli
chat = ChatFriendli(model='meta-llama-3.1-8b-instruct')
for m in chat.stream("Tell me fun things to do in NYC"):
print(m.content, end="", flush=True)
API 参考:ChatFriendli
LLMs
查看一个 使用示例。
from langchain_community.llms.friendli import Friendli
llm = Friendli(model='meta-llama-3.1-8b-instruct')
print(llm.invoke("def bubble_sort(): "))
API 参考:友好