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

feat: create a session when no api_key is passed with a custom URL #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Xoeseko
Copy link

@Xoeseko Xoeseko commented Jul 28, 2023

Building on the work in #52, this PR allows creating a session with a ChatGPT compatible API without passing an api key.

This is the case when self-hosting llama-cpp sever or ChatGPT4All's API for example.

Previously, the top-level API was not able to create a session for open source models using the openAI API:

>>> ai = AIChat(api_key='None', api_url='http://localhost:8000/v1/chat/completions', console=False)
Traceback (most recent call last):
  File "C:\demo.py", line 10, in <module>
    ai = AIChat(
         ^^^^^^^
  File "c:\simpleaichat\simpleaichat.py", line 45, in __init__
    new_session = self.new_session(
                  ^^^^^^^^^^^^^^^^^
  File "c:\simpleaichat\simpleaichat.py", line 81, in new_session
    return sess

By the way I was surprised this didn't work when I tried and was wondering if you were thinking of adding tests to your library ?
I would love to help with that given enough time.

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.

1 participant