We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import aiohttp base_urls = ['https://a.z-pt.com', 'http://chat.darkflow.top'] async def generate_response(prompt): endpoint = 'https://gpt4.gravityengine.cc/api/openai/v1/chat/completions' headers = { 'Content-Type': 'application/json', } data = { 'model': 'gpt-3.5-turbo-16k-0613', 'temperature': 0.7, 'messages': [ {"role": "system", "content": "INSTRUCTIONS HEREEEEEEEEEEEE"}, {"role": "user", "content": prompt}, ] } for attempt in range(2): try: async with aiohttp.ClientSession() as session: async with session.post(endpoint, headers=headers, json=data) as response: response_data = await response.json() choices = response_data['choices'] if choices: return choices[0]['message']['content'] except aiohttp.ClientError as error: print(f'Error making the request with {endpoint}: {error}') if attempt < 1: print('Retrying with a different base URL.') break print('All base URLs failed to provide a response.') return None async def generate_completion(prompt, max_token=None, temp=None): endpoint = '/api/openai/v1/engines/text-davinci-003/completions' headers = {'Content-Type': 'application/json'} async with aiohttp.ClientSession() as session: for base_url in base_urls: url = base_url + endpoint async with session.post(url, headers=headers, json={'prompt': prompt, 'max_tokens': max_token or 2048, 'temperature': temp or 0.7}) as response: if response.status != 200: continue response_data = await response.json() response = response_data['choices'][0]['text'] return response return None
The text was updated successfully, but these errors were encountered:
completion dosent work anymore
Sorry, something went wrong.
Closing since it's broken
No branches or pull requests
The text was updated successfully, but these errors were encountered: