以背景开始聊天
model = GenerativeModel("gemini-1.0-pro", generation_config={"temperature": 0}, tools=[retail_tool])
context = [
Content(role = "user", parts = [
Part(text = "System prompt: You are an assistent who can process json and answers off that."),
Part(text = f"json is provided here {json.dumps(data)}")
]),
Content(role = "model", parts = [Part(text = "understood")])
]
chat2 = model.start_chat(history = context)
我无法提供历史记录来开始聊天对话。出现了以下错误:
ValueError: history must be a list of Content objects.
我在数组中传递了内容对象,但它不接受。其实这个方法应该接受一个字典的列表,这样会简单一些。有没有人知道怎么解决这个问题?我想我没有创建正确的数据类型。只需要一个Python专家来回答这个。相关的函数签名在下面附上。
Documentation is here: https://github.com/googleapis/python-aiplatform/blob/main/vertexai/generative_models/_generative_models.py#L602
1 个回答
暂无回答