diff options
Diffstat (limited to 'gpt4free/forefront')
-rw-r--r-- | gpt4free/forefront/README.md | 9 | ||||
-rw-r--r-- | gpt4free/forefront/__init__.py | 16 | ||||
-rw-r--r-- | gpt4free/forefront/typing.py | 3 |
3 files changed, 14 insertions, 14 deletions
diff --git a/gpt4free/forefront/README.md b/gpt4free/forefront/README.md index 35ba9897..887097ec 100644 --- a/gpt4free/forefront/README.md +++ b/gpt4free/forefront/README.md @@ -6,8 +6,11 @@ from gpt4free import forefront token = forefront.Account.create(logging=False) print(token) # get a response -for response in forefront.StreamingCompletion.create(token=token, - prompt='hello world', model='gpt-4'): - print(response.completion.choices[0].text, end='') +for response in forefront.StreamingCompletion.create( + token=token, + prompt='hello world', + model='gpt-4' +): + print(response.choices[0].text, end='') print("") ```
\ No newline at end of file diff --git a/gpt4free/forefront/__init__.py b/gpt4free/forefront/__init__.py index 969b33b8..4d679a14 100644 --- a/gpt4free/forefront/__init__.py +++ b/gpt4free/forefront/__init__.py @@ -5,8 +5,8 @@ from typing import Generator, Optional from uuid import uuid4 from fake_useragent import UserAgent -from requests import post from pymailtm import MailTm, Message +from requests import post from tls_client import Session from .typing import ForeFrontResponse @@ -43,10 +43,7 @@ class Account: response = client.post( f'https://clerk.forefront.ai/v1/client/sign_ups/{trace_token}/prepare_verification?_clerk_js_version=4.38.4', - data={ - 'strategy': 'email_link', - 'redirect_url': 'https://accounts.forefront.ai/sign-up/verify' - }, + data={'strategy': 'email_link', 'redirect_url': 'https://accounts.forefront.ai/sign-up/verify'}, ) if logging: @@ -93,14 +90,14 @@ class StreamingCompletion: action_type='new', default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default model='gpt-4', - proxy=None + proxy=None, ) -> Generator[ForeFrontResponse, None, None]: if not token: raise Exception('Token is required!') if not chat_id: chat_id = str(uuid4()) - proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else None + proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else None headers = { 'authority': 'chat-server.tenant-forefront-default.knative.chi.coreweave.com', @@ -168,7 +165,7 @@ class Completion: action_type='new', default_persona='607e41fe-95be-497e-8e97-010a59b2e2c0', # default model='gpt-4', - proxy=None + proxy=None, ) -> ForeFrontResponse: text = '' final_response = None @@ -179,7 +176,7 @@ class Completion: action_type=action_type, default_persona=default_persona, model=model, - proxy=proxy + proxy=proxy, ): if response: final_response = response @@ -191,4 +188,3 @@ class Completion: raise Exception('Unable to get the response, Please try again') return final_response -
\ No newline at end of file diff --git a/gpt4free/forefront/typing.py b/gpt4free/forefront/typing.py index a9025419..23e90903 100644 --- a/gpt4free/forefront/typing.py +++ b/gpt4free/forefront/typing.py @@ -1,4 +1,5 @@ from typing import Any, List + from pydantic import BaseModel @@ -22,4 +23,4 @@ class ForeFrontResponse(BaseModel): model: str choices: List[Choice] usage: Usage - text: str
\ No newline at end of file + text: str |