我不明白示例文档中的 customprompt 如何工作:https://python.langchain.com/en/latest/modules/chains/index_examples/qa_with_sources.html
提示对象定义为:
PROMPT = PromptTemplate(template=template, input_variables=["summaries", "question"])
期待两个输入摘要和问题
但是,仅在问题(作为查询)中传递内容,而不是摘要中传递的内容
chain = load_qa_with_sources_chain(OpenAI(temperature=0), chain_type="stuff", prompt=PROMPT)
query = "What did the president say about Justice Breyer"
chain({"input_documents": docs, "question": query}, return_only_outputs=True)
where docs = docsearch.similarity_search(query)
Run Code Online (Sandbox Code Playgroud)
问题 1(针对): input_documentsqa_with_sources如何映射到摘要?
同样,我不清楚链接 https://python.langchain.com/en/latest/modules/chains/index_examples/summarize.html上的文档
prompt_template = """Write a concise summary of the following:
{text}
CONCISE SUMMARY IN ITALIAN:"""
PROMPT = PromptTemplate(template=prompt_template, input_variables=["text"])
chain = load_summarize_chain(OpenAI(temperature=0), chain_type="map_reduce", return_intermediate_steps=True, map_prompt=PROMPT, combine_prompt=PROMPT)
chain({"input_documents": docs}, return_only_outputs=True)
Run Code Online (Sandbox Code Playgroud)
更多问题(针对summarize): 2. docs
是如何映射到text …
我正在尝试将本地目录作为卷传递给气流,而气流又被传递给 dag DockerOperator
\n我的airflow-docker-compose.yaml(在airflow-common部分)如下所示
\n volumes:\n - ./dags:/opt/airflow/dags\n - ./logs:/opt/airflow/logs\n - ./plugins:/opt/airflow/plugins\n - ./input:/opt/airflow/input\n - ./output:/opt/airflow/output\nRun Code Online (Sandbox Code Playgroud)\n在 DAG 代码中,我尝试传递安装参数,如下所示:
\neod_price = DockerOperator(\n task_id='run_docker',\n image='alpine',\n api_version='auto',\n command='/bin/touch /output/run_docker_touch.txt',\n auto_remove=True,\n mounts=[\n Mount(source='/opt/airflow/output',\n target='/app_base/output',\n type='volume'),\n ],\n mount_tmp_dir=False,\n docker_url='tcp://docker-proxy:2375',\n network_mode='bridge'\n )\nRun Code Online (Sandbox Code Playgroud)\n使用这段代码,我收到错误:
\n\n\n错误请求 ("create /opt/airflow/output: "/opt/airflow/output"\n仅包含本地卷名称的无效字符\n"[a-zA-Z0-9][a-zA-Z0- 9_.-]" 是允许的。如果您打算传递\n主机目录,请使用绝对路径")
\n
当我将安装行从 type='volume' 更改为 type='bind' 时:
\nmounts=[\n Mount(source='/opt/airflow/output',\n target='/app_base/output',\n type='bind'),\n ],\nRun Code Online (Sandbox Code Playgroud)\n错误更改为
\n\n\n错误请求(“类型“bind”的安装配置无效:绑定源路径\n不存在:/opt/airflow/output”)
\n
我猛击了 docker007-airflow-scheduler-1 、 docker007-airflow-triggerer-1 、 docker007-airflow-webserver-1 、 docker007-airflow-worker-1 ,在每个容器中我看到 /opt/airflow/output …