我正在尝试使用 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/>助理"""
我也遇到同样的问题,请问找到解决办法了吗?