mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 22:42:05 +00:00
community[patch]: update apify integration to attribute API activity to langchain (#21909)
**Description:** Add `Origin/langchain` to Apify's client's user-agent to attribute API activity to LangChain (at Apify, we aim to monitor our integrations to evaluate whether we should invest more in the LangChain integration regarding functionality and content) **Issue:** None **Dependencies:** None **Twitter handle:** None
This commit is contained in:
@@ -60,7 +60,11 @@ class ApifyDatasetLoader(BaseLoader, BaseModel):
|
||||
try:
|
||||
from apify_client import ApifyClient
|
||||
|
||||
values["apify_client"] = ApifyClient()
|
||||
client = ApifyClient()
|
||||
if httpx_client := getattr(client.http_client, "httpx_client"):
|
||||
httpx_client.headers["user-agent"] += "; Origin/langchain"
|
||||
|
||||
values["apify_client"] = client
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Could not import apify-client Python package. "
|
||||
|
Reference in New Issue
Block a user