strvm / meta-ai-api Goto Github PK
View Code? Open in Web Editor NEWLlama 3 API (MetaAI Reverse Engineered)
Llama 3 API (MetaAI Reverse Engineered)
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.
Can there be a way to make decisions on the previous response or for it to remember the previous response
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.
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.
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'
Hi,
Is there a way to use custom system prompt like : "You're an helpful assistant built by ..."
Thanks!
Seem to be getting invalid json responses/html responses instead of json, intended?
i run meta-ai-api in codespace return this error
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
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.
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.
Hello,
Great work so far, is there any way I can get this to show up in my chat history on meta.ai?
Hi there,
I would like to to run a loop to send a few prompts. but already on the second item I get:
Exception: Unable to obtain a valid response from Meta AI. Try again later.
Does this come because the API token is taken from the browser?
Is there a way to do multiple requests?
Many thanks
Tom
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'))
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
IMPORT_CWD = os.path.abspath(os.getcwd())
OSError: [Errno 5] Input/output error
I'm getting this response:
WARNING:root:Was unable to obtain a valid response from Meta AI. Retrying... Attempt 1/3.
Exception: Unable to obtain a valid response from Meta AI. Try again later.
Any suggestions to address this would be much appreciated! Thanks.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.