From 9c5ead57b65ad8d236706fe1b1c7071f4440ab17 Mon Sep 17 00:00:00 2001 From: Bagus Indrayana Date: Tue, 11 Jul 2023 22:54:25 +0800 Subject: udate testing --- testing/binghuan/helpers/binghuan.py | 11 ++++++++++- testing/binghuan/testing.py | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/testing/binghuan/helpers/binghuan.py b/testing/binghuan/helpers/binghuan.py index 56762ef3..ad3f7ff7 100644 --- a/testing/binghuan/helpers/binghuan.py +++ b/testing/binghuan/helpers/binghuan.py @@ -196,8 +196,17 @@ class AsyncCompletion: await wss.close() +# i thing bing realy donset understand multi message (based on prompt template) +def convert(messages): + context = "" + for message in messages: + context += "[%s](#message)\n%s\n\n" % (message['role'], + message['content']) + return context + async def run(optionSets, messages): - async for value in AsyncCompletion.create(prompt=messages[-1]['content'], + prompt = convert(messages) + async for value in AsyncCompletion.create(prompt=prompt, optionSets=optionSets): print(value, flush=True, end = '') diff --git a/testing/binghuan/testing.py b/testing/binghuan/testing.py index e03c598d..d10b0e96 100644 --- a/testing/binghuan/testing.py +++ b/testing/binghuan/testing.py @@ -2,7 +2,7 @@ from BingHuan import ChatCompletion # Test 1 response = ChatCompletion.create(model="gpt-3.5-turbo", - provider="Wewordle", + provider="BingHuan", stream=False, messages=[{'role': 'user', 'content': 'who are you?'}]) @@ -10,7 +10,7 @@ print(response) # Test 2 response = ChatCompletion.create(model="gpt-3.5-turbo", - provider="Wewordle", + provider="BingHuan", stream=False, messages=[{'role': 'user', 'content': 'what you can do?'}]) @@ -18,8 +18,8 @@ print(response) # Test 3 -response = ChatCompletion.create(model="gpt-3.5-turbo", - provider="Wewordle", +response = ChatCompletion.create(model="gpt-4", + provider="BingHuan", stream=False, messages=[ {'role': 'user', 'content': 'now your name is Bob'}, -- cgit v1.2.3