diff --git a/qa_prompt.py b/qa_prompt.py index 7853567..3e72126 100644 --- a/qa_prompt.py +++ b/qa_prompt.py @@ -1,3 +1,19 @@ +#coding=utf-8 + +# Copyright 2023 Zilliz. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + from typing import List, Tuple, Dict, Optional import logging @@ -21,6 +37,14 @@ Input: {context} """ +ernie_prompt = """根据以下材料回答最末尾的问题: + +{context} + +问题:{question} + +""" + class QAPrompt(PyOperator): def __init__(self, temp: str = None, llm_name: str = None): @@ -34,6 +58,8 @@ class QAPrompt(PyOperator): self._template = dolly_prompt elif llm_name.lower() == 'openai': self._template = gpt_prompt + elif llm_name.lower() == 'ernie': + self._template = ernie_prompt else: logger.warning('Unkown llm_name, use default prompt') self._template = gpt_prompt