You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
# Valves for conversation turn limiting
target_user_roles: List[str] = ["user"]
max_turns: Optional[int] = None
def __init__(self):
self.type = "filter"
self.name = "DSPy-Pipeline"
self.valves = self.Valves(
**{
"pipelines": os.getenv("CONVERSATION_TURN_PIPELINES", "*").split(","),
"max_turns": 1,
}
)
async def on_startup(self):
# This function is called when the server is started.
print(f"on_startup:{__name__}")
pass
async def on_shutdown(self):
# This function is called when the server is stopped.
print(f"on_shutdown:{__name__}")
pass
async def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
print(f"pipe:{__name__}")
print(body)
print(user)
if user.get("role", "admin") in self.valves.target_user_roles:
messages = body.get("messages", [])
if len(messages) > self.valves.max_turns:
raise Exception(
f"Conversation turn limit exceeded. Max turns: {self.valves.max_turns}"
)
return body
`
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 with import 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 or pip install typing_extensions in the respective docker container.
The text was updated successfully, but these errors were encountered:
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: