-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
P1High priority, add to the next sprintHigh priority, add to the next sprint
Description
Discussed in #9499
Originally posted by jantrienes June 5, 2025
What is the correct way to import components like ChatPromptBuilder
? Two ways can be found in the documentation:
# 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:
"ChatPromptBuilder" is not exported from module "haystack.components.builders"
Import from "haystack.components.builders.chat_prompt_builder" instead Pylance[reportPrivateImportUsage](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportPrivateImportUsage.md)
If option 1 is valid, I guess haystack.components.builders
should have exports as below.
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!
denisw
Metadata
Metadata
Assignees
Labels
P1High priority, add to the next sprintHigh priority, add to the next sprint