如何在langchain中使用VertexAIModelGarden?

问题描述 投票:0回答:1

我正在尝试使用 langchain 和 vertex AI 模型花园调用 llama 3 模型。

from langchain_google_vertexai import VertexAIModelGarden
llm = VertexAIModelGarden (project-project_name, endpoint_id=endpoint_id, location=location)
llm.invoke(prompt)

上面的代码工作正常,但我想给出温度、最大令牌参数来控制输出。

llm = VertexAIModelGarden(
  project="YOUR PROJECT", 
  endpoint_id="YOUR ENDPOINT_ID", 
  location=location, 
  allowed_model_args=["max_tokens", "temperature"], stop_sequences=["</eot_id/>"])
prompt = "What is the meaning of Life?"
llm(prompt,1024,0.2)

我尝试使用上面的代码,但收到一个错误,即浮点对象没有属性处理程序。

还尝试通过系统指令给出提示,如下所示

sys_提示=“” 用户输入=“” Prompt_template=F"""<|begin_of_text|>系统<|end_header_id|> {sys_prompt]<|eot_id/>用户<|end_header_id>{user_input}<|eot_id/>助理"""

python-3.x google-cloud-platform langchain large-language-model google-cloud-vertex-ai
1个回答
0
投票

我也遇到同样的问题,请问找到解决办法了吗?

© www.soinside.com 2019 - 2024. All rights reserved.