diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2023-12-23 20:34:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-23 20:34:06 +0100 |
commit | d62b289578018b5df8a6441c0ae6effe163982ea (patch) | |
tree | efb0ef293f88bb47eb21cad22f6b1afdae3e2d80 | |
parent | Added OpenChat's Aura Model as a new Provider (#1371) (diff) | |
parent | Fix streaming in Aura (diff) | |
download | gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar.gz gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar.bz2 gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar.lz gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar.xz gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.tar.zst gpt4free-d62b289578018b5df8a6441c0ae6effe163982ea.zip |
-rw-r--r-- | g4f/Provider/Aura.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/g4f/Provider/Aura.py b/g4f/Provider/Aura.py index fa6025cd..bdc8bafd 100644 --- a/g4f/Provider/Aura.py +++ b/g4f/Provider/Aura.py @@ -32,25 +32,24 @@ class Aura(AsyncGeneratorProvider): "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", } async with ClientSession(headers=headers) as session: - system_prompt="" - system_message=[] + new_messages = [] + system_message = [] for message in messages: - if message["role"]=="system": - system_prompt +=message["content"] + if message["role"] == "system": + system_message.append(message["content"]) else: - system_message.append(message) - + new_messages.append(message) data = { "model": { "id": "openchat_v3.2_mistral", "name": "OpenChat Aura", "maxLength": 24576, "tokenLimit": 8192 - }, - "messages": system_message, + }, + "messages": new_messages, "key": "", - "prompt": f"{system_prompt}", + "prompt": "\n".join(system_message), "temperature": 0.5 - } - async with session.post(f"{cls.url}/api/chat",json=data,proxy=proxy) as response: - yield await response.text()
\ No newline at end of file + } + async with session.post(f"{cls.url}/api/chat", json=data, proxy=proxy) as response: + return response.content.iter_any()
\ No newline at end of file |