Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

AI responds with unnecessary info #232

Closed
zoomingspeed opened this issue Nov 17, 2023 · 8 comments
Closed

AI responds with unnecessary info #232

zoomingspeed opened this issue Nov 17, 2023 · 8 comments
Assignees

Comments

@zoomingspeed
Copy link

zoomingspeed commented Nov 17, 2023

Hi, I have been programming a Discord bot and I have always wanted to add artificial intelligence to it, and finding this repository was like a miracle to me. This works, but I have been having a couple of issues, including the cookies regenerating so the AI stops responding. However I saw an issue saying that dsdanielpark is going to program it this weekend. So my only issue is how the AI responds.

The AI actually responds when running the command and putting a prompt, but it gives me unnecessary information that I do not need. Here is the command and here is how it responds:

# AI TEST
@bot.slash_command(name="ai", description="Get a response from Google Bard's AI")
async def ai(ctx, *, text):
    ai_response = bard.get_answer(text)
    await ctx.defer()
    await asyncio.sleep(30)
    await ctx.followup.send(f"**AI RESPONSE MIGHT BE INACCURATE, WE ARE NOT RESPONSIBLE FOR INACCURATE RESPONSES FROM THE AI CHATBOT:**\n\n```{ai_response}```")

And here is the AI's response from a prompt greeting the AI...

AI RESPONSE MIGHT BE INACCURATE, WE ARE NOT RESPONSIBLE FOR INACCURATE RESPONSES FROM THE AI CHATBOT: # the text that I put because it uses bard. lol

{'content': 'Hi! How can I help you today?', 'conversation_id': 'c_c99f18f950253ddf', 'response_id': 'r_7158afbfa3ae1e32', 'factuality_queries': None, 'text_query': ['هااا', 1], 'choices': [{'id': 'rc_2f034099579186ea', 'content': ['Hi! How can I help you today?']}, {'id': 'rc_52047a2cf9fefa4a', 'content': ['Hi! How can I help you today?\r\n\r\nI am a large language model, also known as a conversational AI or chatbot trained to be informative and comprehensive. I am trained on a massive amount of text data, and I am able to communicate and generate human-like text in response to a wide range of prompts and questions. For example, I can provide summaries of factual topics or create stories.\r\n\r\nWhat can I do for you today?']}, {'id': 'rc_b0760f4fa4e8c862', 'content': ['مرحبا! كيف يمكنني مساعدتك اليوم؟']}], 'links': [], 'images': [], 'program_lang': None, 'code': None, 'status_code': 200}

Seeing this issue, I have dealt with an issue like this using the package "googletrans", but I found out that I can just put ".text", but for some reason it does not work with this package. Is there anyway I can make the AI respond only with the prompt response or is this how it just replies?

@Epiczhul
Copy link

help! i have the same problem

@dsdanielpark
Copy link
Owner

Hello, Epiczhul이, zoomingspeed

Could you please inform me of the version of the Bard API you are using that is experiencing this issue?

Also, I would like to recommend a slight modification to your code as follows. The reason is that the API is designed to return complete information deliberately, and it is recommended to use either ai_response.content or ai_response['content'] instead of just ai_response.

If you only pass the content, you will miss out on other important information. This includes various responses under 'choice' and 'conversation_id', which is crucial for maintaining the context of the conversation.

Please try using the following.

# AI TEST
@bot.slash_command(name="ai", description="Get a response from Google Bard's AI")
async def ai(ctx, *, text):
    ai_response = bard.get_answer(text)
    await ctx.defer()
    await asyncio.sleep(30)
    await ctx.followup.send(f"**AI RESPONSE MIGHT BE INACCURATE, WE ARE NOT RESPONSIBLE FOR INACCURATE RESPONSES FROM THE AI CHATBOT:**\n\n```{ai_response['content']}```")

@zoomingspeed
Copy link
Author

@dsdanielpark i did not think of this thank you, i have not tested it but if it does not work i will let you know. I do want to ask though, have you finished programming the auto rotating cookies and if it is done, will the cookies automatically be generated the minute we run our program or do we have to get a cookie first and place it, THEN it rotates?

@dsdanielpark
Copy link
Owner

szv99 has implemented it, but it seems to involve inserting the token value initially, and then obtaining the cookie value that updates thereafter. Therefore, it might be a partial solution, but I think it would be difficult for the cookie to update completely automatically.

Try asking szv99 about it.

@zoomingspeed
Copy link
Author

@dsdanielpark would this work on a proxy server? i use a server to host my discord bot and it runs a basic python environment. this is the host i use: https://divahosting.net/

@dsdanielpark
Copy link
Owner

You can use this behind a porxy examples.

@zoomingspeed
Copy link
Author

zoomingspeed commented Dec 1, 2023

@dsdanielpark and if i did Bard(token_from_browser=True) along with the behind a proxy example, it would work?

@dsdanielpark
Copy link
Owner

zoomingspeed

It still works under limited conditions, but does not operate when hosted on a server. Since it is implemented from the following package, I recommend examining the logic. In fact, the cookie auto-update logic that will be updated soon might be more effective. If you are interested, please take a look at the following PR. #235

browser_cookie3

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

No branches or pull requests

3 participants