File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -2082,6 +2082,11 @@ def setup(self, **kwargs) -> "Self":
20822082 Use before running map/gen/agg/batch_map to save an object and pass it as an
20832083 argument to the UDF.
20842084
2085+ The value must be a callable (a `lambda: <value>` syntax can be used to quickly
2086+ create one) that returns the object to be passed to the UDF. It is evaluated
2087+ lazily when UDF is running, in case of multiple machines the callable is run on
2088+ a worker machine.
2089+
20852090 Example:
20862091 ```py
20872092 import anthropic
@@ -2091,7 +2096,11 @@ def setup(self, **kwargs) -> "Self":
20912096 (
20922097 dc.read_storage(DATA, type="text")
20932098 .settings(parallel=4, cache=True)
2099+
2100+ # Setup Anthropic client and pass it to the UDF below automatically
2101+ # The value is callable (see the note above)
20942102 .setup(client=lambda: anthropic.Anthropic(api_key=API_KEY))
2103+
20952104 .map(
20962105 claude=lambda client, file: client.messages.create(
20972106 model=MODEL,
You can’t perform that action at this time.
0 commit comments