meta-ai-api


Namemeta-ai-api JSON
Version 1.1.7 PyPI version JSON
download
home_pagehttps://github.com/tomchen/example_pypi_package
SummaryMeta AI API Wrapper to interact with the Meta AI API
upload_time2024-04-24 20:48:51
maintainerNone
docs_urlNone
authorRoméo Phillips
requires_python>=3.6
licenseNone
keywords llm ai meta_ai_api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MetaAI API Wrapper

MetaAI is a Python library designed to interact with Meta's AI APIs that run in the backend of https://www.meta.ai/. It encapsulates the complexities of authentication and communication with the APIs, providing a straightforward interface for sending queries and receiving responses.

With this you can easily prompt the AI with a message and get a response, directly from your Python code. **NO API KEY REQUIRED**

**Meta AI is connected to the internet, so you will be able to get the latest real-time responses from the AI.** (powered by Bing)

Meta AI is running Llama 3 LLM.

## Features
- **Prompt AI**: Send a message to the AI and get a response from Llama 3.
- **Image Generation**: Generate images using the AI. (Only for FB authenticated users)
- **Get Up To Date Information**: Get the latest information from the AI thanks to its connection to the internet.
- **Get Sources**: Get the sources of the information provided by the AI.
- **Streaming**: Stream the AI's response in real-time or get the final response.

## Usage
**Download**:

   ```bash
   pip install meta-ai-api
   ```
   
**Initialization**:

```python
from meta_ai_api import MetaAI

ai = MetaAI()
response = ai.prompt(message="Whats the weather in San Francisco today? And what is the date?")
print(response)
 
```
```json
{
   "message":"The weather in San Francisco today is mostly clear to overcast, with no precipitation, a wind speed between 0 and 8 miles per hour and temperatures ranging from 51 to 55 degrees Fahrenheit ¹. The date is Friday, April 19, 2024 ². Please note that the weather forecast is continually changing ³ ⁴ ⁵ ⁶.\n",
   "sources":[
      {
         "link":"https://www.wolframalpha.com/input?i=San+Francisco+weather+today+and+date",
         "title":"WolframAlpha"
      },
      {
         "link":"https://www.timeanddate.com/weather/usa/san-francisco",
         "title":"Weather for San Francisco, California, USA - timeanddate.com"
      },
      {
         "link":"https://www.accuweather.com/en/us/san-francisco/94103/weather-today/347629",
         "title":"Weather Today for San Francisco, CA | AccuWeather"
      },
      {
         "link":"https://www.accuweather.com/en/us/san-francisco/94103/weather-forecast/347629",
         "title":"San Francisco, CA Weather Forecast | AccuWeather"
      },
      {
         "link":"https://forecast.weather.gov/zipcity.php?inputstring=San%20francisco%2CCA",
         "title":"National Weather Service"
      },
      {
         "link":"https://www.wunderground.com/weather/us/ca/san-francisco",
         "title":"San Francisco, CA Weather Conditions | Weather Underground"
      }
   ]
}
```
---
```python
from meta_ai_api import MetaAI

ai = MetaAI()
response = ai.prompt(message="What was the Warriors score last game?")
print(response)
```
```json
{
   "message":"The Golden State Warriors' last game was against the Sacramento Kings, and they lost 118-94 ¹ ². Stephen Curry scored 22 points, and the Kings' win eliminated the Warriors from the playoffs ³. The Warriors finished the season 46-36 and 10th in the Western Conference ⁴ ³.\n",
   "sources":[
      {
         "link":"https://sportradar.com/",
         "title":"Game Info of NBA from sportradar.com"
      },
      {
         "link":"https://www.sofascore.com/team/basketball/golden-state-warriors/3428",
         "title":"Golden State Warriors live scores & schedule - Sofascore"
      },
      {
         "link":"https://www.foxsports.com/nba/golden-state-warriors-team-schedule",
         "title":"Golden State Warriors Schedule & Scores - NBA - FOX Sports"
      },
      {
         "link":"https://en.wikipedia.org/wiki/History_of_the_Golden_State_Warriors",
         "title":"History of the Golden State Warriors"
      }
   ]
}
```

**Using proxy**:

```python
from meta_ai_api import MetaAI

proxy = {
    'http': 'http://proxy_address:port',
    'https': 'https://proxy_address:port'
}

ai = MetaAI(proxy=proxy)
response = ai.prompt(message="How to find out which mushrooms are edible?")
print(response)
```

**Streaming Response**:

```python
from meta_ai_api import MetaAI

ai = MetaAI()
response = ai.prompt(message="What was the Warriors score last game?", stream=True)
for r in response:
    print(r)
```

```
{'message': '\n', 'sources': []}
{'message': 'The\n', 'sources': []}
{'message': 'The Golden\n', 'sources': []}
{'message': 'The Golden State\n', 'sources': []}
{'message': 'The Golden State Warriors\n', 'sources': []}
{'message': "The Golden State Warriors'\n", 'sources': []}
{'message': "The Golden State Warriors' last\n", 'sources': []}
{'message': "The Golden State Warriors' last game\n", 'sources': []}
{'message': "The Golden State Warriors' last game was\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against the\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against the Sacramento\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against the Sacramento Kings\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against the Sacramento Kings on\n", 'sources': []}
{'message': "The Golden State Warriors' last game was against the Sacramento Kings on April\n", 'sources': []}
...
{'message': "The Golden State Warriors' last game was against the Sacramento Kings on April 16, 2024, at the Golden 1 Center in Sacramento, California. The Kings won the game with a score of 118-94, with the Warriors scoring 22 points in the first quarter, 28 in the second, 26 in the third and 18 in the fourth quarter ¹.\n", 'sources': [{'link': 'https://sportradar.com/', 'title': 'Game Info of NBA from sportradar.com'}]}
```

**Generate Image**:

By default image generation is only available for FB authenticated users. If you go on https://www.meta.ai/ , and ask the AI to generate an image, you will be prompted to authenticate with Facebook.
So if you want to generate images using this library, you need to authenticate using your FB credentials.

**Note**: There seems to be higher rate limits for authenticated users. So only authenticate to generate images.

```python
from meta_ai_api import MetaAI
ai = MetaAI(fb_email="your_fb_email", fb_password="your_fb_password")
resp = ai.prompt(message="Generate an image of a tech CEO")
print(resp)
```

```json
{
   "message":"\n",
   "sources":[
      
   ],
   "media":[
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/4282108942387920518_1946149595_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=103&ccb=9-4&oh=00_AfCnbCX7nl_J5kF6mahnams4d99Rs5WZA780HGS_scfc6A&oe=662771EE&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"a tech CEO"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3356467762794691754_1025991308_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=108&ccb=9-4&oh=00_AfBLmSbTSqshNAL82KIFk8hGXyL8iK_CZLGcMmmddPrxuA&oe=66276EDD&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"a tech CEO"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/127487551948523111_2181921077_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=104&ccb=9-4&oh=00_AfAejXKeKPA4vyKXoc6UR0rEirvZwi41P3KiCSQmHRHsEw&oe=66276E45&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"a tech CEO"
      },
      {
         "url":"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3497663176351797954_3954783377_21-04-2024-14-17-47.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=110&ccb=9-4&oh=00_AfBp3bAfcuofqtI-z9D4bHw-GuGgCNPH_xhMM0PG_95S9Q&oe=66277AE9&_nc_sid=5b3566",
         "type":"IMAGE",
         "prompt":"a tech CEO"
      }
   ]
}
```
![Tech CEO](https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3497663176351797954_3954783377_21-04-2024-14-17-47.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=110&ccb=9-4&oh=00_AfBp3bAfcuofqtI-z9D4bHw-GuGgCNPH_xhMM0PG_95S9Q&oe=66277AE9&_nc_sid=5b3566)

# Copyright:
This program is licensed under the GNU GPL v3. All code has been written by me, Strvm.

# Copyright Notice:
```
Strvm/meta-ai-api: a reverse engineered API wrapper for MetaAI
Copyright (C) 2023 ading2210

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tomchen/example_pypi_package",
    "name": "meta-ai-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "llm, ai, meta_ai_api",
    "author": "Rom\u00e9o Phillips",
    "author_email": "phillipsromeo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b3/d5/470248d5251c69ad41416d1611cf910bfb4b2c4d4f2d2660cf16ca8e99e2/meta_ai_api-1.1.7.tar.gz",
    "platform": null,
    "description": "# MetaAI API Wrapper\n\nMetaAI is a Python library designed to interact with Meta's AI APIs that run in the backend of https://www.meta.ai/. It encapsulates the complexities of authentication and communication with the APIs, providing a straightforward interface for sending queries and receiving responses.\n\nWith this you can easily prompt the AI with a message and get a response, directly from your Python code. **NO API KEY REQUIRED**\n\n**Meta AI is connected to the internet, so you will be able to get the latest real-time responses from the AI.** (powered by Bing)\n\nMeta AI is running Llama 3 LLM.\n\n## Features\n- **Prompt AI**: Send a message to the AI and get a response from Llama 3.\n- **Image Generation**: Generate images using the AI. (Only for FB authenticated users)\n- **Get Up To Date Information**: Get the latest information from the AI thanks to its connection to the internet.\n- **Get Sources**: Get the sources of the information provided by the AI.\n- **Streaming**: Stream the AI's response in real-time or get the final response.\n\n## Usage\n**Download**:\n\n   ```bash\n   pip install meta-ai-api\n   ```\n   \n**Initialization**:\n\n```python\nfrom meta_ai_api import MetaAI\n\nai = MetaAI()\nresponse = ai.prompt(message=\"Whats the weather in San Francisco today? And what is the date?\")\nprint(response)\n \n```\n```json\n{\n   \"message\":\"The weather in San Francisco today is mostly clear to overcast, with no precipitation, a wind speed between 0 and 8 miles per hour and temperatures ranging from 51 to 55 degrees Fahrenheit \u00b9. The date is Friday, April 19, 2024 \u00b2. Please note that the weather forecast is continually changing \u00b3 \u2074 \u2075 \u2076.\\n\",\n   \"sources\":[\n      {\n         \"link\":\"https://www.wolframalpha.com/input?i=San+Francisco+weather+today+and+date\",\n         \"title\":\"WolframAlpha\"\n      },\n      {\n         \"link\":\"https://www.timeanddate.com/weather/usa/san-francisco\",\n         \"title\":\"Weather for San Francisco, California, USA - timeanddate.com\"\n      },\n      {\n         \"link\":\"https://www.accuweather.com/en/us/san-francisco/94103/weather-today/347629\",\n         \"title\":\"Weather Today for San Francisco, CA | AccuWeather\"\n      },\n      {\n         \"link\":\"https://www.accuweather.com/en/us/san-francisco/94103/weather-forecast/347629\",\n         \"title\":\"San Francisco, CA Weather Forecast | AccuWeather\"\n      },\n      {\n         \"link\":\"https://forecast.weather.gov/zipcity.php?inputstring=San%20francisco%2CCA\",\n         \"title\":\"National Weather Service\"\n      },\n      {\n         \"link\":\"https://www.wunderground.com/weather/us/ca/san-francisco\",\n         \"title\":\"San Francisco, CA Weather Conditions | Weather Underground\"\n      }\n   ]\n}\n```\n---\n```python\nfrom meta_ai_api import MetaAI\n\nai = MetaAI()\nresponse = ai.prompt(message=\"What was the Warriors score last game?\")\nprint(response)\n```\n```json\n{\n   \"message\":\"The Golden State Warriors' last game was against the Sacramento Kings, and they lost 118-94 \u00b9 \u00b2. Stephen Curry scored 22 points, and the Kings' win eliminated the Warriors from the playoffs \u00b3. The Warriors finished the season 46-36 and 10th in the Western Conference \u2074 \u00b3.\\n\",\n   \"sources\":[\n      {\n         \"link\":\"https://sportradar.com/\",\n         \"title\":\"Game Info of NBA from sportradar.com\"\n      },\n      {\n         \"link\":\"https://www.sofascore.com/team/basketball/golden-state-warriors/3428\",\n         \"title\":\"Golden State Warriors live scores & schedule - Sofascore\"\n      },\n      {\n         \"link\":\"https://www.foxsports.com/nba/golden-state-warriors-team-schedule\",\n         \"title\":\"Golden State Warriors Schedule & Scores - NBA - FOX Sports\"\n      },\n      {\n         \"link\":\"https://en.wikipedia.org/wiki/History_of_the_Golden_State_Warriors\",\n         \"title\":\"History of the Golden State Warriors\"\n      }\n   ]\n}\n```\n\n**Using proxy**:\n\n```python\nfrom meta_ai_api import MetaAI\n\nproxy = {\n    'http': 'http://proxy_address:port',\n    'https': 'https://proxy_address:port'\n}\n\nai = MetaAI(proxy=proxy)\nresponse = ai.prompt(message=\"How to find out which mushrooms are edible?\")\nprint(response)\n```\n\n**Streaming Response**:\n\n```python\nfrom meta_ai_api import MetaAI\n\nai = MetaAI()\nresponse = ai.prompt(message=\"What was the Warriors score last game?\", stream=True)\nfor r in response:\n    print(r)\n```\n\n```\n{'message': '\\n', 'sources': []}\n{'message': 'The\\n', 'sources': []}\n{'message': 'The Golden\\n', 'sources': []}\n{'message': 'The Golden State\\n', 'sources': []}\n{'message': 'The Golden State Warriors\\n', 'sources': []}\n{'message': \"The Golden State Warriors'\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against the\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against the Sacramento\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against the Sacramento Kings\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against the Sacramento Kings on\\n\", 'sources': []}\n{'message': \"The Golden State Warriors' last game was against the Sacramento Kings on April\\n\", 'sources': []}\n...\n{'message': \"The Golden State Warriors' last game was against the Sacramento Kings on April 16, 2024, at the Golden 1 Center in Sacramento, California. The Kings won the game with a score of 118-94, with the Warriors scoring 22 points in the first quarter, 28 in the second, 26 in the third and 18 in the fourth quarter \u00b9.\\n\", 'sources': [{'link': 'https://sportradar.com/', 'title': 'Game Info of NBA from sportradar.com'}]}\n```\n\n**Generate Image**:\n\nBy default image generation is only available for FB authenticated users. If you go on https://www.meta.ai/ , and ask the AI to generate an image, you will be prompted to authenticate with Facebook.\nSo if you want to generate images using this library, you need to authenticate using your FB credentials.\n\n**Note**: There seems to be higher rate limits for authenticated users. So only authenticate to generate images.\n\n```python\nfrom meta_ai_api import MetaAI\nai = MetaAI(fb_email=\"your_fb_email\", fb_password=\"your_fb_password\")\nresp = ai.prompt(message=\"Generate an image of a tech CEO\")\nprint(resp)\n```\n\n```json\n{\n   \"message\":\"\\n\",\n   \"sources\":[\n      \n   ],\n   \"media\":[\n      {\n         \"url\":\"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/4282108942387920518_1946149595_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=103&ccb=9-4&oh=00_AfCnbCX7nl_J5kF6mahnams4d99Rs5WZA780HGS_scfc6A&oe=662771EE&_nc_sid=5b3566\",\n         \"type\":\"IMAGE\",\n         \"prompt\":\"a tech CEO\"\n      },\n      {\n         \"url\":\"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3356467762794691754_1025991308_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=108&ccb=9-4&oh=00_AfBLmSbTSqshNAL82KIFk8hGXyL8iK_CZLGcMmmddPrxuA&oe=66276EDD&_nc_sid=5b3566\",\n         \"type\":\"IMAGE\",\n         \"prompt\":\"a tech CEO\"\n      },\n      {\n         \"url\":\"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/127487551948523111_2181921077_21-04-2024-14-17-48.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=104&ccb=9-4&oh=00_AfAejXKeKPA4vyKXoc6UR0rEirvZwi41P3KiCSQmHRHsEw&oe=66276E45&_nc_sid=5b3566\",\n         \"type\":\"IMAGE\",\n         \"prompt\":\"a tech CEO\"\n      },\n      {\n         \"url\":\"https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3497663176351797954_3954783377_21-04-2024-14-17-47.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=110&ccb=9-4&oh=00_AfBp3bAfcuofqtI-z9D4bHw-GuGgCNPH_xhMM0PG_95S9Q&oe=66277AE9&_nc_sid=5b3566\",\n         \"type\":\"IMAGE\",\n         \"prompt\":\"a tech CEO\"\n      }\n   ]\n}\n```\n![Tech CEO](https://scontent-lax3-1.xx.fbcdn.net/o1/v/t0/f1/m247/3497663176351797954_3954783377_21-04-2024-14-17-47.jpeg?_nc_ht=scontent-lax3-1.xx.fbcdn.net&_nc_cat=110&ccb=9-4&oh=00_AfBp3bAfcuofqtI-z9D4bHw-GuGgCNPH_xhMM0PG_95S9Q&oe=66277AE9&_nc_sid=5b3566)\n\n# Copyright:\nThis program is licensed under the GNU GPL v3. All code has been written by me, Strvm.\n\n# Copyright Notice:\n```\nStrvm/meta-ai-api: a reverse engineered API wrapper for MetaAI\nCopyright (C) 2023 ading2210\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <https://www.gnu.org/licenses/>.\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Meta AI API Wrapper to interact with the Meta AI API",
    "version": "1.1.7",
    "project_urls": {
        "Bug Reports": "https://github.com/Strvm/meta-ai-api",
        "Documentation": "https://github.com/Strvm/meta-ai-api",
        "Homepage": "https://github.com/tomchen/example_pypi_package",
        "Source Code": "https://github.com/Strvm/meta-ai-api"
    },
    "split_keywords": [
        "llm",
        " ai",
        " meta_ai_api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68c2adf82f5e18840e0894900047fd8e29a12c02bd8becc4563891348675e842",
                "md5": "08aeb82b9717fbada933e27aa4306e65",
                "sha256": "8a663c1f78f29c01df8ba7df29bd9733e719e02d07081571c0f9e6c835277afc"
            },
            "downloads": -1,
            "filename": "meta_ai_api-1.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08aeb82b9717fbada933e27aa4306e65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11933,
            "upload_time": "2024-04-24T20:48:48",
            "upload_time_iso_8601": "2024-04-24T20:48:48.461747Z",
            "url": "https://files.pythonhosted.org/packages/68/c2/adf82f5e18840e0894900047fd8e29a12c02bd8becc4563891348675e842/meta_ai_api-1.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3d5470248d5251c69ad41416d1611cf910bfb4b2c4d4f2d2660cf16ca8e99e2",
                "md5": "cd6b684b0c6bd1da91794a7a69db6b4a",
                "sha256": "b71cfd9ff29c4d34a9532f36bce46609864919bbe1e2cdb847e737714a2e04b0"
            },
            "downloads": -1,
            "filename": "meta_ai_api-1.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "cd6b684b0c6bd1da91794a7a69db6b4a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 14495,
            "upload_time": "2024-04-24T20:48:51",
            "upload_time_iso_8601": "2024-04-24T20:48:51.398713Z",
            "url": "https://files.pythonhosted.org/packages/b3/d5/470248d5251c69ad41416d1611cf910bfb4b2c4d4f2d2660cf16ca8e99e2/meta_ai_api-1.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-24 20:48:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tomchen",
    "github_project": "example_pypi_package",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "meta-ai-api"
}
        
Elapsed time: 0.23930s