我在 langchain 中编写了一个应用程序,它将多个链传递给顺序链来运行。我遇到的问题是提示太大,超出了 4K 令牌限制大小。我看到 OpenAI 为 ChatGPT 发布了一个新的 16K 令牌窗口大小的模型,但我似乎无法从 API 访问它。当我尝试时,出现以下错误:
openai.error.InvalidRequestError:这是一个聊天模型,v1/completions 端点不支持。您的意思是使用 v1/chat/completions 吗?
这是我尝试实例化模型的方式:
self.llm = OpenAI(model='gpt-3.5-turbo-16k',temperature = self.config.llm.temperature,
openai_api_key = self.config.llm.openai_api_key,
max_tokens=self.config.llm.max_tokens
)
Run Code Online (Sandbox Code Playgroud)
有人知道我该如何解决这个问题吗?
我正在尝试在 Amazon AWS EC2 实例 (Ubuntu 18.04) 上运行的 kubernetes 集群上创建持久卷。我在尝试创建 kubectl 时收到错误。
我尝试查找错误,但没有得到任何令人满意的搜索结果。
这是我正在使用的 pv.yaml 文件。
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv001
labels:
type: local
spec:
capacity:
storage: 1Gi
storageClassName: manual
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
hostPath:
path: /home/ubuntu/data/pv001
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误:
Error from server (BadRequest): error when creating "./mysql-pv.yaml":
PersistentVolume in version "v1" cannot be handled as a
PersistentVolume: v1.PersistentVolume.Spec:
v1.PersistentVolumeSpec.PersistentVolumeSource: HostPath: Capacity:
unmarshalerDecoder: quantities must match the regular expression
'^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$', error found in #10 byte
of ...|":"manual"},"hostPat|..., bigger context …Run Code Online (Sandbox Code Playgroud) 我正在学习如何使用 langchain,并且我编写了一个小练习来尝试弄清楚代理是如何工作的。
我有一个小的 Python 程序,如下所示:
import os
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
topic = input("Topic: ")
prompt = PromptTemplate(input_variables = ['topic'],
template = '''
You have been given access to a search
tool. Please gather information about the
AI algorithm topic{topic}, and write a
thousand word blog post on this topic.
'''
)
os.environ['SERPAPI_API_KEY'] = <"my serpapi key">
llm = OpenAI(model = 'text-davinci-003', temperature = 0.7,openai_api_key = "<my openAPI …Run Code Online (Sandbox Code Playgroud)