You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sources/platform/actors/development/builds_and_runs/state_persistence.md
+51-4Lines changed: 51 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ By default, an Actor keeps its state in the server's memory. During a server swi
51
51
52
52
The [Apify SDKs](/sdk) handle state persistence automatically.
53
53
54
-
This is done using the `Actor.on()` method and the `migrating` event.
54
+
This is done using the `Actor.on()` method and the `migrating` event.
55
55
56
56
- The `migrating` event is triggered just before a migration occurs, allowing you to save your state.
57
57
- To retrieve previously saved state, you can use the [`Actor.getValue`](/sdk/js/reference/class/Actor#getValue)/[`Actor.get_value`](/sdk/python/reference/class/Actor#get_value) methods.
index = VectorstoreIndexCreator(embedding=OpenAIEmbeddings()).from_loaders([loader])
114
+
index = VectorstoreIndexCreator(
115
+
vectorstore_cls=InMemoryVectorStore,
116
+
embedding=OpenAIEmbeddings()
117
+
).from_loaders([loader])
108
118
query ="What is LangChain?"
109
-
result = index.query_with_sources(query, llm=OpenAI())
119
+
result = index.query_with_sources(query, llm=llm)
110
120
111
121
print("answer:", result["answer"])
112
122
print("source:", result["sources"])
@@ -117,9 +127,11 @@ To run it, you can use the following command: `python langchain_integration.py`
117
127
After running the code, you should see the following output:
118
128
119
129
```text
120
-
answer: LangChain is a framework for developing applications powered by language models. It provides standard, extendable interfaces, external integrations, and end-to-end implementations for off-the-shelf use. It also integrates with other LLMs, systems, and products to create a vibrant and thriving ecosystem.
130
+
answer: LangChain is a framework designed for developing applications powered by large language models (LLMs). It simplifies the
131
+
entire application lifecycle, from development to productionization and deployment. LangChain provides open-source components a
132
+
nd integrates with various third-party tools, making it easier to build and optimize applications using language models.
description: Learn how to build AI Agents with Apify and LangGraph 🦜🔘➡️.
5
+
sidebar_position: 1
6
+
slug: /integrations/langgraph
7
+
---
8
+
9
+
**Learn how to build AI Agents with Apify and LangGraph.**
10
+
11
+
---
12
+
13
+
## What is LangGraph
14
+
15
+
[LangGraph](https://www.langchain.com/langgraph) is a framework designed for constructing stateful, multi-agent applications with Large Language Models (LLMs), allowing developers to build complex AI agent workflows that can leverage tools, APIs, and databases.
16
+
17
+
:::note Explore LangGraph
18
+
19
+
For more in-depth details on LangGraph, check out its [official documentation](https://langchain-ai.github.io/langgraph/).
20
+
21
+
:::
22
+
23
+
## How to use Apify with LangGraph
24
+
25
+
This guide will demonstrate how to use Apify Actors with LangGraph by building a ReAct agent that will use the [RAG Web Browser](https://apify.com/apify/rag-web-browser) Actor to search Google for TikTok profiles and [TikTok Data Extractor](https://apify.com/clockworks/free-tiktok-scraper) Actor to extract data from the TikTok profiles to analyze the profiles.
26
+
27
+
### Prerequisites
28
+
29
+
-**Apify API token**: To use Apify Actors in LangGraph, you need an Apify API token. If you don't have one, you can learn how to obtain it in the [Apify documentation](https://docs.apify.com/platform/integrations/api).
30
+
31
+
-**OpenAI API key**: In order to work with agents in LangGraph, you need an OpenAI API key. If you don't have one, you can get it from the [OpenAI platform](https://platform.openai.com/account/api-keys).
32
+
33
+
-**Python packages**: You need to install the following Python packages:
================================== AI Message ==================================
110
+
111
+
The OpenAI TikTok profile is titled "OpenAI (@openai) Official." Here are some key details about the profile:
112
+
113
+
- **Followers**: 592.3K
114
+
- **Likes**: 3.3M
115
+
- **Description**: The profile features "low key research previews" and includes videos that showcase their various projects and research developments.
Copy file name to clipboardExpand all lines: sources/platform/storage/dataset.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ You can then use that variable to [access the dataset's items and manage it](/ap
147
147
148
148
> When using the [`.list_items()`](/api/client/python/reference/class/DatasetClient#list_items) method, if you fill both `omit` and `field` parameters with the same value, then `omit` parameter will take precedence and the field is excluded from the results.
149
149
150
-
Check out the [Python API client documentation](/api/client/python/reference/class/DatasetClient) for [help with setup](/api/client/python/docs) and more details.
150
+
Check out the [Python API client documentation](/api/client/python/reference/class/DatasetClient) for [help with setup](/api/client/python/docs/overview/introduction) and more details.
You can then use that variable to [access the key-value store's items and manage it](/api/client/python/reference/class/KeyValueStoreClient).
126
126
127
-
Check out the [Python API client documentation](/api/client/python/reference/class/KeyValueStoreClient) for [help with setup](/api/client/python/docs) and more details.
127
+
Check out the [Python API client documentation](/api/client/python/reference/class/KeyValueStoreClient) for [help with setup](/api/client/python/docs/overview/introduction) and more details.
You can then use that variable to [access the request queue's items and manage it](/api/client/python/reference/class/RequestQueueClient).
137
137
138
-
Check out the [Python API client documentation](/api/client/python/reference/class/RequestQueueClient) for [help with setup](/api/client/python/docs) and more details.
138
+
Check out the [Python API client documentation](/api/client/python/reference/class/RequestQueueClient) for [help with setup](/api/client/python/docs/overview/introduction) and more details.
0 commit comments