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

Add support of GPT provider. #1567

Open
lk-geimfari opened this issue Jun 18, 2024 · 9 comments
Open

Add support of GPT provider. #1567

lk-geimfari opened this issue Jun 18, 2024 · 9 comments
Assignees
Labels
feature Feature request help wanted Nee help

Comments

@lk-geimfari
Copy link
Owner

lk-geimfari commented Jun 18, 2024

If something the user needs is not supported by Mimesis, they can generate it using OpenAI, like this:

from mimesis.plugins.gpt import ChatGPT

>>> chat_gpt = ChatGPT(api_key='API_KEY_HERE')
>>> chat_gpt.assistant_message = "You are a test data generator."
>>> chat_gpt.user_message = (
    "Generate a random {prompt}. "
    "Please make sure that nothing except the {prompt} is in the output."
)
>>> chat_gpt.chat("japanese city name", model="gpt-3.5-turbo")
'翔太'

>>> chat_gpt.image("ninja shiba pixel art") # returns image encoded in base64 (or, maybe as BytesIO object)

This is just an example; the API is not finalized yet.

@lk-geimfari lk-geimfari added the feature Feature request label Jun 18, 2024
@lk-geimfari lk-geimfari self-assigned this Jun 18, 2024
@lk-geimfari
Copy link
Owner Author

I'm currently working on this, but help is welcome.

@lk-geimfari lk-geimfari added the help wanted Nee help label Jun 18, 2024
@Rangeeshar
Copy link

Hi @lk-geimfari , If you are not working on this I could create this plugin from your example code.

@lk-geimfari
Copy link
Owner Author

Hi @lk-geimfari , If you are not working on this I could create this plugin from your example code.

Sure!

@Rangeeshar
Copy link

Rangeeshar commented Jun 20, 2024

Hi @lk-geimfari , couple of thoughts. For the accessibility should use free LLM to generate the results like random text, image, and audio based on the prompt. It will unlock lot of users who can test us without any subscription to chatgpt plus or to even chatgpt.

@lk-geimfari
Copy link
Owner Author

Hi @lk-geimfari , couple of thoughts. For the accessibility should use free LLM to generate the results like random text, image, and audio based on the prompt. It will unlock lot of users who can test us without any subscription to chatgpt plus or to even chatgpt.

I'd prefer to avoid a lot of optional deps, but overall the idea is a good one.

@Rangeeshar
Copy link

Rangeeshar commented Jun 21, 2024

@lk-geimfari check this draft PR.
Rangeeshar#1 Let me know if you need any other change on top of this.
I can make model dynamic and other params dynamic which could be passed to hugging face by our users.

After this I can create an Image based one and audio based one.
Once we push this out. I could create a plugin which you can attach any AI in future.

@lk-geimfari
Copy link
Owner Author

I like it! Looks good. A good idea would be to use try/except when importing libs that will be optional. See the example in plugins/pytest.py. Also, do not foget include optional deps to pyproject.toml so we will be able to install all optional AI-related deps like this:

> pip install mimesis[ai]

@lk-geimfari
Copy link
Owner Author

Also, don't forget the tests. Tests are good, we love them.

@Rangeeshar
Copy link

Rangeeshar commented Jun 24, 2024

Hi man @lk-geimfari , added a draft PR. Please add some comments If you think something needs a change.
#1571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request help wanted Nee help
Projects
None yet
Development

No branches or pull requests

2 participants