-
Notifications
You must be signed in to change notification settings - Fork 67
Description
I'm using KGGen as a data pipeline to serve a medium-scale knowledge graph creation pipeline and am choosing to serve models via the vLLM Open AI API server to achieve compatibility rather than make an OpenAI API call as the pricing would just be astronomical. Given that, I ran into this problem between the latest vLLM version and the required dependency for KGGen:
uv add -U kg-gen==0.2.0 dspy-ai==2.6.27 litellm
× No solution found when resolving dependencies:
╰─▶ Because kg-gen==0.2.0 depends on openai==1.61.0 and vllm==0.10.0 depends on openai>=1.87.0,<=1.90.0, we can conclude that kg-gen==0.2.0 and vllm==0.10.0 are incompatible.
And because your project depends on kg-gen==0.2.0 and vllm==0.10.0, we can conclude that your project's requirements are unsatisfiable.
I came up on this problem because I had this issue:
AttributeError Traceback (most recent call last)
line 3 1 # KGGen uses LiteLLM under the hood; we’ll point it at our local vLLM OpenAI endpoint.
2 # See KGGen README (model string format & base_url override). ----> 3 from kg_gen import KGGen 5 # LiteLLM-compatible "OpenAI" provider; vLLM exposes OpenAI /v1 API at BASE_URL 6 KGGEN_MODEL = f"openai/{SERVED_MODEL_NAME}"
File ~/kg_extract/kge/.venv/lib/python3.10/site-packages/kg_gen/init.py:1 ----> 1 from .kg_gen import KGGen 2 from .models import Graph File ~/kg_extract/kge/.venv/lib/python3.10/site-packages/kg_gen/kg_gen.py:4 1 from typing import Union, List, Dict, Optional 2 from openai import OpenAI ----> 4 from .steps._1_get_entities import get_entities 5 from .steps._2_get_relations import get_relations 6 from .steps._3_cluster_graph import cluster_graph
File ~/kg_extract/kge/.venv/lib/python3.10/site-packages/kg_gen/steps/_1_get_entities.py:19 16 source_text: str = dspy.InputField() 17 entities: list[str] = dspy.OutputField(desc="THOROUGH list of key entities") ---> 19 def get_entities(dspy: dspy.dspy, input_data: str, is_conversation: bool = False) -> List[str]: 20 if is_conversation: 21 extract = dspy.Predict(ConversationEntities)
AttributeError: module 'dspy' has no attribute 'dspy'
And this is my current workaround:
import importlib
dspy = importlib.import_module("dspy")
if not hasattr(dspy, "dspy"):
dspy.dspy = dspy # satisfy bad type annotation used inside kg_gen<=0.1.x