What is the correct way to import components? (aka pylance reportPrivateImportUsage error) #9499
Answered
by
anakin87
jantrienes
asked this question in
Questions
-
What is the correct way to import components like # Option 1
from haystack.components.builders import ChatPromptBuilder
# Option 2
from haystack.components.builders.chat_prompt_builder import ChatPromptBuilder While both work fine, option 1 leads to following Pylance error:
If option 1 is valid, I guess if TYPE_CHECKING:
from .answer_builder import AnswerBuilder as AnswerBuilder
from .chat_prompt_builder import ChatPromptBuilder as ChatPromptBuilder
from .prompt_builder import PromptBuilder as PromptBuilder This would align with typing conventions and makes Pylance happy, but I am not familiar enough to say for sure. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
anakin87
Jun 10, 2025
Replies: 1 comment
-
Thanks for reporting this. Since your solution seems OK, I converted this report into an issue and responded there: #9506 (comment). |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jantrienes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for reporting this.
Since your solution seems OK, I converted this report into an issue and responded there: #9506 (comment).