Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lfx/src/lfx/_assets/component_index.json

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions src/lfx/src/lfx/components/langchain_utilities/langchain_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from langchain_core.prompts import HumanMessagePromptTemplate

from lfx.custom.custom_component.component import Component
from lfx.inputs.inputs import DefaultPromptField, SecretStrInput, StrInput
from lfx.inputs.inputs import DefaultPromptField, DropdownInput, SecretStrInput, StrInput
from lfx.io import Output
from lfx.schema.message import Message

Expand All @@ -23,6 +23,14 @@ class LangChainHubPromptComponent(Component):
info="The LangChain API Key to use.",
required=True,
),
DropdownInput(
name="region",
display_name="Region",
info="Select the LangChain Hub region (US or EU)",
options=["US", "EU"],
value="US",
required=True,
),
StrInput(
name="langchain_hub_prompt",
display_name="LangChain Hub Prompt",
Expand Down Expand Up @@ -122,5 +130,8 @@ def _fetch_langchain_hub_template(self):

raise ValueError(msg)

# Determine the API URL based on region
api_url = "https://api.hub.langchain.com" if self.region == "US" else "https://eu.api.hub.langchain.com"

# Pull the prompt from LangChain Hub
return langchain.hub.pull(self.langchain_hub_prompt, api_key=self.langchain_api_key)
return langchain.hub.pull(self.langchain_hub_prompt, api_key=self.langchain_api_key, api_url=api_url)
Loading