Skip to content
New issue

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

Need Help scraping API #925

Open
TwangyMoney opened this issue Aug 14, 2023 · 1 comment
Open

Need Help scraping API #925

TwangyMoney opened this issue Aug 14, 2023 · 1 comment

Comments

@TwangyMoney
Copy link

Can someone help me with this I'm having trouble. It feels really complex for me to understand how this works. This is basically what I'm trying to do:
async def generate_response(instructions, history=None):
if history is None:
data = {
"model": "gpt-3.5-turbo-16k-0613",
"temperature": 0.75,
"messages": [
{"role": "system", "content": instructions},
],
}
else:
data = {
"model": "gpt-3.5-turbo-16k-0613",
"temperature": 0.75,
"messages": [
{"role": "system", "content": instructions},
*history,
],
}

endpoint = "https://gpt4.xunika.uk/api/openai/v1/chat/completions"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer ak-wwwchatgptorguk",
}

try:
    async with aiohttp.ClientSession() as session:
        async with session.post(endpoint, headers=headers, json=data) as response:
            response_data = await response.json()
            print(f"response_data: {response.status}")
            choices = response_data["choices"]
            if choices:
                return choices[0]["message"]["content"]
except aiohttp.ClientError as error:
    print("Error making the request:", error)
    
  How can I implement portia here so it bypasses CloudFlare and gives me my response?
@gabriel-batistuta
Copy link

It seems that this project is no longer being maintained, OpenAI is making it difficult to use free APIs, so I recommend you check out this other, more active repository to solve your problem: https://github.com/PawanOsman/ChatGPT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants