Comments (4)
Thanks for trying to help, I figured it was just a novice mistake somewhere along the way. Error:
File "{HOME}/redenv/lib/python3.11/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)
from meta-ai-api.
Hi, the python method will return a python dictionary (which could be converted into JSON). Could I see the code you are using?
Thanks!
from meta-ai-api.
I'm likely not handling the response correctly.
I attempted to just make a super simple Redbot based Discord bot as a proof of concept, using the command !meta [query]:
from redbot.core import commands
from meta_ai_api import MetaAI
class MetaBot(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.ai = MetaAI()
@commands.command()
async def meta(self, ctx, *, query: str):
"""Send a query to Meta AI and get a response."""
try:
response = self.ai.prompt(message=query)
if response:
await ctx.send(response['message'])
if 'sources' in response:
sources = '\n'.join([f"[{src['title']}]({src['link']})" for src in response['sources']])
await ctx.send(f"**Sources:**\n{sources}")
else:
await ctx.send("No response received from Meta AI.")
except Exception as e:
await ctx.send(f"Error occurred: {str(e)}")
from meta-ai-api.
I was able to get sources using similar code to yours:
response = ai.prompt(message="Whats the weather in San Francisco today? And what is the date?", stream=False)
sources = '\n'.join([f"[{src['title']}]({src['link']})" for src in response['sources']])
print(sources)
[WolframAlpha](https://www.wolframalpha.com/input?i=San+Francisco+weather+today+and+date)
[San Francisco 14 Day Extended Forecast - Weather - Time and Date](https://www.timeanddate.com/weather/usa/san-francisco/ext)
[Hourly forecast for San Francisco, California, USA - Time and Date](https://www.timeanddate.com/weather/usa/san-francisco/hourly)
[Past Weather in San Francisco, California, USA - Time and Date](https://www.timeanddate.com/weather/usa/san-francisco/historic)
[Weather for San Francisco, California, USA - Time and Date](https://www.timeanddate.com/weather/usa/san-francisco)
Not sure what seems to be the issue on your side, do you get an error?
from meta-ai-api.
Related Issues (20)
- Proxy issue [probably] HOT 5
- [Q] Custom system prompt? HOT 2
- installation Error HOT 1
- Making decisions on the previous response HOT 2
- Was unable to obtain a valid response from Meta AI HOT 1
- WARNING:root:Was unable to obtain a valid response from Meta AI. Retrying... Attempt 1/3. HOT 19
- KeyError: "name='xs', domain=None, path=None" HOT 12
- Location error HOT 1
- raise FacebookRegionBlocked( meta_ai_api.exceptions.FacebookRegionBlocked: Unable to receive a valid response from Meta AI. This is likely due to your region being blocked. Try manually accessing https://www.meta.ai/ to confirm. HOT 2
- Getting FacebookInvalidCredentialsException error when credential are correct
- Handle ConnectionError HOT 1
- Reusable sessions HOT 1
- Kept getting error: "FacebookInvalidCredentialsException: Was not able to login to Facebook. You may also have been rate limited. Try to connect to Facebook manually." HOT 4
- OpenAI API schema HOT 2
- Exception: Unable to obtain a valid response from Meta AI. Try again later. HOT 13
- Regarding Meta.ai follow up Qs?
- Exception: Unable to obtain a valid response from Meta AI. Try again later. HOT 2
- Beautiful Soup error Cannot find input feild
- Errors when running this lib via github actions.
- Error on first run HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meta-ai-api.