Giter Club home page Giter Club logo

meta-ai-api's Introduction

Hi there ๐Ÿ‘‹

meta-ai-api's People

Contributors

romeoava avatar strvm avatar themanyfaceddemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meta-ai-api's Issues

Kept getting error: "FacebookInvalidCredentialsException: Was not able to login to Facebook. You may also have been rate limited. Try to connect to Facebook manually."

Iโ€™ve made multiple attempts but continue to receive the error: FacebookInvalidCredentialsException: Unable to login to Facebook. Please verify your credentials. You may have been rate limited. Attempt to connect to Facebook manually.

When I tried to log in manually, it requested email or phone verification.

I think the code needs to be revised to handle this scenario. It should select email verification in the backend and prompt the user to check their email and input the verification code.

Imagine Feature Request

Could you add a login feature? Because using the prompt
Imagine: prompt indicates that you need to log in
{'message': 'Please log in to generate images.\n', 'sources': []}
Thank you for your work.

Reusable sessions

Hey Creator, I appreciate your work for Meta AI API. But, it would be nice, if you include reusable sessions. Like, If I start chatting with the AI, the next prompt should continue with the same conversation. The context should be preserved.

Location error

Maybe this is just a simple error that I can fix myself by reading to code more closely.
Made a fresh Facebook account without two factor authentication.
It seems to succeed logging in to Facebook from both Toronto CA and Columbus IN USA
But then fails here.

Traceback (most recent call last):
File "/home/alpha/second.py", line 3, in
ai = MetaAI( fb_email="XXXXXXXXX", fb_password="XXXXXXX" )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alpha/.venv/lib/python3.11/site-packages/meta_ai_api/main.py", line 50, in init
self.cookies = self.get_cookies()
^^^^^^^^^^^^^^^^^^
File "/home/alpha/.venv/lib/python3.11/site-packages/meta_ai_api/main.py", line 316, in get_cookies
fb_session = get_fb_session(self.fb_email, self.fb_password)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alpha/.venv/lib/python3.11/site-packages/meta_ai_api/utils.py", line 210, in get_fb_session
next_url = response.headers["Location"]
~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/home/alpha/.venv/lib/python3.11/site-packages/requests/structures.py", line 52, in getitem
return self._store[key.lower()][1]
~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'location'

[Q] Custom system prompt?

Hi,

Is there a way to use custom system prompt like : "You're an helpful assistant built by ..."

Thanks!

Proxy issue [probably]

Perhaps I made a mistake somewhere when creating a proxy. The following happens:
With this code:

from meta_ai_api import MetaAI
import requests

proxy_ip = '157.25.92.74'
proxy_port = 3128

proxies = {
    'http': f'http://{proxy_ip}:{proxy_port}'
}

try:
    ai = MetaAI(proxy=proxies)
    response = ai.prompt(message="How to find out which mushrooms are edible?")
except ConnectionError as ce:
    print(f"CE: {ce}")
except TimeoutError as te:
    print(f"TE: {te}")
except Exception as err:
    print(f"ERR: {err}")

The program displays my current IP.
Still, there was no need to try to write the connection proxy code myself. Or I don't understand something

Error when trying to get "response"

Code:

from meta_ai_api import MetaAI
import traceback

try:
    ai = MetaAI()
    response = ai.prompt(message="What was the Warriors score last game?")
    if response:
        print(response)
    else:
        print("response is not valid")
except Exception as e:
    print(f"Errror: {e}")
    traceback.print_exc()

When I try to run the script I get the following:

G:\Desktop>python test.py
Errror: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\Desktop\test.py", line 6, in <module>
    response = ai.prompt(message="What was the Warriors score last game?")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\meta_ai_api\main.py", line 95, in prompt
    self.access_token = self.get_access_token()
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\meta_ai_api\main.py", line 71, in get_access_token
    auth_json = response.json()
                ^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

G:\Desktop>python test.py
Errror: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "G:\Desktop\test.py", line 6, in <module>
    response = ai.prompt(message="What was the Warriors score last game?")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\meta_ai_api\main.py", line 95, in prompt
    self.access_token = self.get_access_token()
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\meta_ai_api\main.py", line 71, in get_access_token
    auth_json = response.json()
                ^^^^^^^^^^^^^^^
  File "C:\Users\Cain\AppData\Roaming\Python\Python311\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I don't fully understand what the problem is.

Was unable to obtain a valid response from Meta AI

A few days ago I used the api to get some responses from llama3 and it worked like a charm, now I tried to get the responses using a loop and didn't work, not even single responses is working now. My code is

from meta_ai_api import MetaAI

abacatada = ['flu', 'roundworm', 'AIDS', 'hepatitis', 'threadworms']

ai = MetaAI()

for i in range(len(abacatada)):
    response = ai.prompt(message=f"I will say something, only answer me if one of the following: Worm, Disease. How would you classify: {abacatada[i]}")
    print(response['message'])

Using llama3 direct from the browser is working, I am using jupyter.

Handle ConnectionError

Handle ConnectionError from requests package when there is internet failure. This causes dev servers to crush. Making it fail safely would be nice.

\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.meta.ai', 
port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001708DAC4D50>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Getting FacebookInvalidCredentialsException error when credential are correct

Hi, I am getting FacebookInvalidCredentialsException exception and my credentials are correct, I have also tried to use different Facebook accounts but I'm still getting the same error

this is the full error message

    raise FacebookInvalidCredentialsException(
meta_ai_api.exceptions.FacebookInvalidCredentialsException: Was not able to login to Facebook. Please check your credentials. You may also have been rate limited. Try to connect to Facebook manually.

Please what can I do to fix it? thanks

installation Error

IMPORT_CWD = os.path.abspath(os.getcwd())
OSError: [Errno 5] Input/output error

KeyError: "name='xs', domain=None, path=None"

when i ran the code from either python or jupiter notebook with these lines

from meta_ai_api import MetaAI

ai = MetaAI(fb_email="someemail", fb_password="somepassword")
response = ai.prompt(message="Whats the weather in San Francisco today? And what is the date?")
print(response)

i got


Traceback (most recent call last):
  File "d:\Python\metaaitest\main.py", line 185, in <module>
    funcGenNews(news)
  File "d:\Python\metaaitest\main.py", line 92, in funcGenNews
    ai = CustomMetaAI()
  File "d:\Python\metaaitest\src\meta_ai.py", line 19, in __init__
    super().__init__(fb_email=fb_email, fb_password=fb_password)
  File "D:\Python\tiktok-content-news-AI\.venv\lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\utils.py", line 157, in get_fb_session
    "xs": session.cookies["xs"],
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 334, in __getitem__
    return self._find_no_duplicates(name)
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 413, in _find_no_duplicates
    raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}")
KeyError: "name='xs', domain=None, path=None"

im using vpn to avoid region block, yesterday was fine as butter. idk why it happens

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.