diff options
Diffstat (limited to 'g4f/Provider/Theb.py')
-rw-r--r-- | g4f/Provider/Theb.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/g4f/Provider/Theb.py b/g4f/Provider/Theb.py index 9a47bb89..72fce3ac 100644 --- a/g4f/Provider/Theb.py +++ b/g4f/Provider/Theb.py @@ -1,6 +1,11 @@ -import json, random, requests +from __future__ import annotations -from ..typing import Any, CreateResult +import json +import random + +import requests + +from ..typing import Any, CreateResult from .base_provider import BaseProvider @@ -17,10 +22,8 @@ class Theb(BaseProvider): messages: list[dict[str, str]], stream: bool, **kwargs: Any) -> CreateResult: - conversation = '' - for message in messages: - conversation += '%s: %s\n' % (message['role'], message['content']) - conversation += 'assistant: ' + conversation = "\n".join(f"{message['role']}: {message['content']}" for message in messages) + conversation += "\nassistant: " auth = kwargs.get("auth", { "bearer_token":"free", |