-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Can't import dspy in my pipeline file #400
Comments
Try putting a "requirements" header on the file with dspy listed. For instance, check out this example: https://github.com/open-webui/pipelines/blob/main/examples/pipelines/rag/haystack_pipeline.py#L8 |
I am getting the same kind of error when trying to import ChatOpenAI from langchain_openai, the error is: The pipeline image I am using is open-webui/pipelines:git-db29eb2 |
@Rensing1 I have managed to solve this issue by adding the pipeline (without requirements) via the docker-compose volumes and passing requirements in .txt file and setting PIPELINES_REQUIREMENTS_PATH to point to the requirements file |
Thanks for the responses! Adding the requirements header in the pipeline.py helped. Using a requirements.txt file also seems to help. Another fix is using "pip install ..." in the docker bash, also for some reason this resetted itself sometimes for me. |
I want to use the DSPy framework in my pipeline. But before I could implement anything, I already get an error when I try to import the DSPy module.
When I upload my pipeline.py into open-webui, I receive the message that the upload was successful; however, no new pipeline is available.
Everything works fine when I don't use
import dspy
at the top of my pipeline.py. This rest of the file content is basically copied from the pipeline examples folder.Here's the code:
import os
from typing import List, Optional
from pydantic import BaseModel
from schemas import OpenAIChatMessage
import time
import dspy
class Pipeline:
class Valves(BaseModel):
pipelines: List[str] = []
priority: int = 0
`
And here is the relevant part of the output from
docker logs webui
:upload_pipeline 1 pipeline.py
INFO: 172.19.0.1:45164 - "POST /api/v1/pipelines/upload HTTP/1.1" 200 OK
INFO: 172.19.0.1:45164 - "GET /api/v1/pipelines/?urlIdx=1 HTTP/1.1" 200 OK
INFO [open_webui.routers.openai] get_all_models()
INFO [open_webui.routers.ollama] get_all_models()
INFO: 172.19.0.1:45180 - "GET /api/models HTTP/1.1" 200 OK
INFO: 172.19.0.1:45164 - "GET /api/v1/pipelines/pipeline/valves/spec?urlIdx=1 HTTP/1.1" 200 OK
INFO: 172.19.0.1:45180 - "GET /api/v1/pipelines/pipeline/valves?urlIdx=1 HTTP/1.1" 200 OK
WARNI [python_multipart.multipart] Skipping data after last boundary
upload_pipeline 1 pipeline.py
INFO: 172.19.0.1:58594 - "POST /api/v1/pipelines/upload HTTP/1.1" 200 OK
INFO: 172.19.0.1:58594 - "GET /api/v1/pipelines/?urlIdx=1 HTTP/1.1" 200 OK
INFO [open_webui.routers.openai] get_all_models()
INFO [open_webui.routers.ollama] get_all_models()
INFO: 172.19.0.1:58608 - "GET /api/models HTTP/1.1" 200 OK
The first upload is the file without
import dspy
, the second upload is withimport dspy
.And here is the output from
docker logs pipelines
:INFO: 172.19.0.3:37984 - "POST /pipelines/upload HTTP/1.1" 200 OK
INFO: 172.19.0.3:37996 - "GET /pipelines HTTP/1.1" 200 OK
INFO: 172.19.0.3:38010 - "GET /models HTTP/1.1" 200 OK
WARNING:root:No Pipeline class found in pipeline
Error loading module: pipeline
Failed to import dspy: cannot import name 'TypeIs' from 'typing_extensions' (/usr/local/lib/python3.11/site-packages/typing_extensions.py)
INFO: 172.19.0.3:51356 - "POST /pipelines/upload HTTP/1.1" 200 OK
INFO: 172.19.0.3:51368 - "GET /pipelines HTTP/1.1" 200 OK
INFO: 172.19.0.3:51384 - "GET /models HTTP/1.1" 200 OK
The error can't be resolved by
pip install dspy
orpip install typing_extensions
in the respective docker container.The text was updated successfully, but these errors were encountered: