GithubHelp home page GithubHelp logo

Comments (2)

Kiyliy avatar Kiyliy commented on July 24, 2024

我修改了我的User_question, 于是出现了使用英文提问可以, 使用中文提问不行的情况
User_question = input("User: ")
prompt = r"""{
{"role": "system","content":"You are a function_selector engine,
you can only selecte one function from the following functions,and cannot interpret or explain user questions:
```json
1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
3.{{echo(str)}}
4.{{Translation(text=TEXT)}}
5.{{AiDrawPrompt()}}
6.{{QuestionAnswer()}}(default function)
7.{{CodeInterpret()}}}",{{"role": "user","content": "select function to assistant user,
please do not explain anything,user question:"""+f"{{{{"{User_question}"}}}}"+""" select function like {{exampleFunction()}}"}}"""

from chatgpt.

Kiyliy avatar Kiyliy commented on July 24, 2024

我又做了更多的测试, 并略微修改了一下提示词, 我确信这是一个bug:
你们可以尝试下面的代码, 会发现无论如何都会报错, 但是当我在提示词的末尾, """}}select function, 添加一个空格, 变成""" }}select function, 这个代码就会变成下面的情况

  1. "英文" : 正常, 示例: "hi"
  2. "中文: error ,示例: "你好"
  3. 中文+英文 ,正常 , 示例: 你好 hi
  4. 英文+ 中文, error, 示例, hi 你好
    """""""""""""

from revChatGPT.V1 import Chatbot

def echo(str):
return str

chatbot = Chatbot(config={
"access_token": "token"
})

print("Chatbot: ")
prev_text = ""
User_question = input("User: ")
prompt_test ="hi"
prompt = r"""{
{"role": "system","content":"You are a function_selector engine,
you can only selecte one function from the following functions,and cannot interpret or explain user questions:
```json
1.{{webfun.WebSearch(search=YOUR_SEARCH)}}
2.{{webfun.ReadWeb(IsProxy=bool,url=URL)}}
3.{{echo(str)}}
4.{{Translation(text=TEXT)}}
5.{{AiDrawPrompt()}}
6.{{QuestionAnswer()}}(default function)
7.{{CodeInterpret()}}}",{{"role": "user","content": "select function to assistant user,
please do not explain anything,user question:{{"""+f"{User_question}"+"""}}select function like {{exampleFunction()}}"}}"""
print(prompt)
print("type(prompt)=",type(prompt))
print("type(prompt_test)=",type(prompt_test))

for data in chatbot.ask(
prompt,
):

message = data["message"][len(prev_text):]
print(message, end="", flush=True)
prev_text = data["message"]

print()
print("message=",message)
print("prev_text=",prev_text)
print("data=",data)
""""""""""""

from chatgpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.