Skip to content

Commit 638364b

Browse files
committed
Update LangChain integration to remove wrong links and information about RAG-Web-Browser
1 parent 39c0cd2 commit 638364b

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

sources/platform/integrations/ai/langchain.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ In this example, we'll use the [Website Content Crawler](https://apify.com/apify
1616
Then we feed the documents into a vector index and answer questions from it.
1717

1818
This example focuses on how to integrate Apify with LangChain using the Python language,
19-
but if you prefer to use JavaScript, you can follow the same steps in the [JavaScript LangChain documentation](https://js.langchain.com/docs/modules/indexes/document_loaders/examples/web_loaders/apify_dataset).
19+
but if you prefer to use JavaScript, you can follow the same steps in the [JavaScript LangChain documentation](https://js.langchain.com/docs/integrations/document_loaders/web_loaders/apify_dataset/).
2020

2121
Before we start with the integration, we need to install all dependencies:
2222

@@ -122,11 +122,27 @@ answer: LangChain is a framework for developing applications powered by language
122122
source: https://python.langchain.com
123123
```
124124

125-
LangChain is a standard interface through which you can interact with a variety of large language models (LLMs). It provides modules you can use to build language model applications. It also provides chains and agents with memory capabilities.
125+
LangChain is a standard interface through which you can interact with a variety of large language models (LLMs).
126+
It provides modules you can use to build language model applications as well as chains and agents with memory capabilities.
127+
128+
You can use all of Apify’s Actors as document loaders in LangChain.
129+
For example, to incorporate web browsing functionality, you can use the [RAG-Web-Browser](https://apify.com/apify/rag-web-browser) Actor.
130+
This allows you to either crawl and scrape top pages from Google Search results or directly scrape text content from a URL and return it as Markdown.
131+
To set this up, change the `actor_id` to `apify/rag-web-browser` and specify the `run_input`.
132+
133+
```python
134+
loader = apify.call_actor(
135+
actor_id="apify/rag-web-browser",
136+
run_input={"query": "apify langchain web browser", "maxResults": 3},
137+
dataset_mapping_function=lambda item: Document(page_content=item["text"] or "", metadata={"source": item["metadata"]["url"]}),
138+
)
139+
print("Documents:", loader.load())
140+
```
141+
142+
In the similar way, you can use other Apify Actors to load data into LangChain and query the vector index.
126143

127144
## Resources
128145

129-
- https://python.langchain.com/docs/get_started/introduction
130-
- https://python.langchain.com/docs/integrations/document_loaders/apify_dataset
131-
- https://python.langchain.com/docs/integrations/providers/apify
132-
- https://python.langchain.com/docs/modules/model_io/llms/
146+
- [LangChain introduction](https://python.langchain.com/docs/get_started/introduction)
147+
- [Apify Dataset loader](https://python.langchain.com/docs/integrations/document_loaders/apify_dataset)
148+
- [LangChain Apify Provider](https://python.langchain.com/docs/integrations/providers/apify)

0 commit comments

Comments
 (0)