以编程方式使用文档

Shale Protocol 提供生产就绪的开放 LLM 推理 API。这是一个即插即用的 API,托管在高度可扩展的 GPU 云基础设施上。

我们的免费套餐支持每个密钥每天最多 1K 次请求,因为我们希望消除任何人在开始使用 LLM 构建 genAI 应用时的障碍。

With Shale Protocol, developers/researchers can create apps and explore the capabilities of open LLMs at no cost.

本页介绍如何将 Shale-Serve API 与 LangChain 结合使用。

截至 2023 年 6 月,该 API 默认支持 Vicuna-13B。我们将在未来版本中支持更多 LLM,如 Falcon-40B。

如何使用

1. Find the link to our Discord on https://shaleprotocol.com. generate an API key through the "Shale bot" on our Discord. no credit card is required and no free trials. it's a forever free tier with 1K limit per day per API key

2. Use https://shale.live/v1 as OpenAI API drop-in replacement

例如

from langchain_openai import OpenAI
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser

os.environ['OPENAI_API_BASE'] = "https://shale.live/v1"
os.environ['OPENAI_API_KEY'] = "ENTER YOUR API KEY"

llm = OpenAI()

template = """Question: {question}

# Answer: Let's think step by step."""

prompt = PromptTemplate.from_template(template)


llm_chain = prompt | llm | StrOutputParser()

question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"

llm_chain.invoke(question)