Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.13k stars 935 forks source link

Chainlit and Ollama HTTPX Dependancy Issue #739

Closed jmdevita closed 8 months ago

jmdevita commented 9 months ago

Chainlit version 0.7.501 is installed with ollama version 0.1.6. OAUTH does not work as the user.py file is not included in Chainlit version 0.7.501. When attempting to update Chainlit to version 1.0.0, a mismatch error on httpx==0.24.1 occurs, with this error:

chainlit 1.0.0 depends on httpx<0.25.0 and >=0.23.0 ollama 0.1.6 depends on httpx<0.26.0 and >=0.25.2

Current workaround is to manually add this user.py file to the chainlit repo.

pchalasani commented 8 months ago

Agree. This is blocking any project that has chainlit 1.0.200 from installing the ollama python sdk, which is currently extremely useful due to its recent OpenAI-compatible API support.

pchalasani commented 8 months ago

Current workaround is to manually add this user.py file to the chainlit repo.

can you elaborate on this workaround? thanks

jmdevita commented 8 months ago

Workaround

I create a copy a file "user.py" to the existing chainlit directory (this file already exists in the newer versions of chainlit).

In step form:
  1. Create a file called "user.py"
  2. In the file, place this code (this is what's in the newer version, I just copy-pasted it)

from dataclasses_json import DataClassJsonMixin from pydantic.dataclasses import Field, dataclass

Provider = Literal[ "credentials", "header", "github", "google", "azure-ad", "okta", "auth0", "descope" ]

class UserDict(TypedDict): id: str identifier: str metadata: Dict

Used when logging-in a user

@dataclass class User(DataClassJsonMixin): identifier: str metadata: Dict = Field(default_factory=dict)

@dataclass class PersistedUserFields: id: str createdAt: str

@dataclass class PersistedUser(User, PersistedUserFields): pass



3. Save the file and move/copy to the directory chainlit is installed in (I use python virtual environment 'env' in this example)
- env/lib/python3.10/site-packages/chainlit/
- Note that the python3.10 folder may vary depending on what version of python you are using
4. Run the chainlit app and it should be working.
<img width="311" alt="Screenshot 2024-02-12 at 3 56 35 PM" src="https://github.com/Chainlit/chainlit/assets/53025729/b907575e-67bc-455e-8f83-541a31b52ea7">
willydouhard commented 8 months ago

This should be fixed, we relaxed the httpx dependency.