Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Poe-api as LLM reference #425

Closed
wants to merge 7 commits into from

Conversation

Iamprashanth-1
Copy link

@Iamprashanth-1 Iamprashanth-1 commented Aug 2, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.

@Iamprashanth-1
Copy link
Author

Adding Poe-api support because people don't have billing on their account or their API limit is exceeded they use this poe-api

@gventuri

Copy link
Contributor

@mspronesti mspronesti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to run this ? I get a AttributeError: 'NoneType' object has no attribute 'group' (same specifying formkey, same installing poe with -U).

Besides, this implementation contains quite a lot of leftovers from your copy-paste of the gpt4all PR and some encapsulation mistakes. If you have a fix for the first problem (which seems to be a known issue, see here), I will be happy to leave a more detailed review.

@Iamprashanth-1
Copy link
Author

Iamprashanth-1 commented Aug 3, 2023

can you let me know which bot have you tried? mostly it works well with Assitant and ChatGpt. (Ya I have Copied all gpt4all PR because I didn't thought of going to entire code as I want to use this pandasai so instantly copied gpt4all and replaced components with poe-api)

I agree I have copied

Prashanth Reddy Munagala added 2 commits August 3, 2023 16:03
@mspronesti
Copy link
Contributor

mspronesti commented Aug 3, 2023

I tried chinchilla, but the problem's not there. This simple snippet fails for me

import poe

token=...
formkey=...

client = poe.Client(token=token, formkey=formkey)

There are multiple issues reporting the same error I mentioned in my previous comment. Seems to be something recurrent. Have a look here

@Iamprashanth-1
Copy link
Author

Iamprashanth-1 commented Aug 3, 2023

Here Is the example:

from pandasai import PandasAI
from pandasai.llm.poe_api import POEAPI

llm = POEAPI(bot_name='chinchilla',token = '')
pandas_ai = PandasAI(llm,enable_cache=False , )
pandas_ai([df_tweets, df_tweet_users], "What are the top tweets?")

Just try this once:

don't need to provide formkey. To get token go through readme once

There are some issues using poe-api but chatgpt and assitant works fine

@mspronesti
Copy link
Contributor

mspronesti commented Aug 3, 2023

As explained above, it does not work for me neither with nor without the formkey. Also, to use your snippet I would need the dataframes :-)
I used the from_dataframe example available in this repository replacing the llm and it yields the named error. This error has nothing to do with the bot or the model, rather with the instanciation of the client. Here's the full log to show it:

Traceback (most recent call last):
  File "C:\Users\mpronesti\dev\pandas-ai\examples\from_dataframe.py", line 11, in <module>
    llm = POEAPI(token='CENSORED', bot_name='chinchilla')
  File "C:\Users\mpronesti\AppData\Local\Programs\Python\Python310\lib\site-packages\pandasai\llm\poe_api.py", line 80, in __init__
    self.poe_api_bot = poe.Client(token=self.token)
  File "C:\Users\mpronesti\AppData\Local\Programs\Python\Python310\lib\site-packages\poe\__init__.py", line 156, in __init__
    self.connect_ws()
  File "C:\Users\mpronesti\AppData\Local\Programs\Python\Python310\lib\site-packages\poe\__init__.py", line 446, in connect_ws
    self.setup_connection()
  File "C:\Users\mpronesti\AppData\Local\Programs\Python\Python310\lib\site-packages\poe\__init__.py", line 182, in setup_connection
    self.next_data = self.get_next_data(overwrite_vars=True)
  File "C:\Users\mpronesti\AppData\Local\Programs\Python\Python310\lib\site-packages\poe\__init__.py", line 246, in get_next_data
    json_text = re.search(json_regex, r.text).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

@Iamprashanth-1
Copy link
Author

Iamprashanth-1 commented Aug 3, 2023

but when I tried It's working fine. can you check your poe.com account whether promt is available in respective bot.

P.s you copied token from poe.com account right i.e (p_b value)

@mspronesti
Copy link
Contributor

Of course. An invalid or missing token in poe api would raise the following errorRuntimeError: Invalid or missing token. which is not the case for me. Anyway if it might be a problem with my setup, I let somebody else try this and give you feedback (even if that seems to be a very common problem among the poe api community).
If Gabriele wants to merge your PR, I will be happy to leave it a more thorough review.

@Iamprashanth-1
Copy link
Author

Can you update poe-api package to latest version and try once

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

Successfully merging this pull request may close these issues.

3 participants