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: docs/topics/generators.mdx
+25-18Lines changed: 25 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,38 +8,45 @@ Underlying LLMs (or any function which completes text) is represented as a gener
8
8
9
9
## Identifiers
10
10
11
-
Much like database connection strings, Rigging generators can be represented as strings which define what provider, model, API key, generation params, etc should be used. They are formatted as follows:
11
+
Much like database connection strings, Rigging generators can be represented as strings which define what provider, model, API key, generation params, etc should be used.
12
+
13
+
<Note>
14
+
Throughout our code, we frequently use these generator identifiers as CLI arguments, environment variables, and API parameters. They are convenient for passing around complex configurations without having to represent model configurations in multiple places. They are also used to serialize generators to storage when chats are stored, so you can save and load them easily without having to reconfigure the generator each time.
-`provider` maps to a particular subclass of `Generator`.
39
+
-`provider` maps to a particular subclass of `Generator` (optional).
18
40
-`model` is a any `str` value, typically used by the provider to indicate a specific LLM to target.
19
41
-`kwargs` are used to carry:
20
42
1. API key (`,api_key=...`) or the base URL (`,api_base=...`) for the model provider.
21
43
1. Serialized `GenerateParams`fields like like temp, stop tokens, etc.
22
44
1. Additional provider-specific attributes to set on the constructed generator class. For instance, you
23
45
can set the `LiteLLMGenerator.max_connections`property by passing `,max_connections=` in the identifier string.
24
46
25
-
The provider is optional and Rigging will fallback to [`litellm`](https://github.com/BerriAI/litellm)/`LiteLLMGenerator` by default.
47
+
The provider is optional and Rigging will fallback to [`litellm`](https://github.com/BerriAI/litellm)/`LiteLLMGenerator` by default.
26
48
You can view the [LiteLLM docs](https://docs.litellm.ai/docs/) for more information about supported model providers and parameters.
27
49
28
-
<Note>
29
-
Throughout our code, we frequently use these generator identifiers as CLI arguments, environment variables, and API parameters. They work like database connection strings and are super convenient for passing around complex configurations. They are also used to serialize generators to storage, so you can save and load them easily.
Copy file name to clipboardExpand all lines: docs/topics/tools.mdx
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,7 +229,7 @@ The `max_depth` parameter limits how many levels deep tool calls can go. If a to
229
229
230
230
### Stopping Tool Calls
231
231
232
-
You may want to use a particular tool, or catch a condition inside a tool, and indicate to any pipelines that it should stop going back to the model for more calls. You can do this by raising a `rigging.Stop` exception with a message to the model.
232
+
You may want to use a particular tool, or catch a condition inside a tool, and indicate to any pipelines that it should stop going back to the model for more calls. You can do this by raising or returning a `rigging.Stop` exception with a message to be passed back to the model for context.
if"<flag>"in output: # Stop the model from executing more code
243
-
raise rg.Stop(f"Task finished")
243
+
return rg.Stop(f"Task finished")# or `raise rg.Stop("Task finished")`
244
244
245
245
return output
246
246
@@ -252,6 +252,10 @@ chat = (
252
252
)
253
253
```
254
254
255
+
<Tip>
256
+
Returning the `rg.Stop` exception instead of raising it is helpful if you don't want any surrounding code (decorators that wrap the tool function) to catch the exception, alter it, or behave as if a typical exception occurred.
257
+
</Tip>
258
+
255
259
<Note>
256
260
This stop indication won't completely halt the pipeline, but it will let it continue to any additional parsing mechanics or custom callbacks which follow tool calling.
0 commit comments