Skip to content

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

Open
Xoeseko wants to merge 1 commit into
minimaxir:mainfrom
Xoeseko:feat/allow_custom_api_without_key
Open

feat: create a session when no api_key is passed with a custom URL#62
Xoeseko wants to merge 1 commit into
minimaxir:mainfrom
Xoeseko:feat/allow_custom_api_without_key

Conversation

@Xoeseko

@Xoeseko Xoeseko commented Jul 28, 2023

Copy link
Copy Markdown

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