|
19 | 19 | "\n", |
20 | 20 | ":::note\n", |
21 | 21 | "Remote validation inferencing is only available in Guardrails versions 0.5.0 and above.\n", |
22 | | - ":::\n", |
23 | | - "\n", |
24 | | - "::note\n", |
25 | | - "To enable/disable, you can run the cli command `guardrails configure` or modify your `~/.guardrailsrc`. For example, to disable remote inference use: `use_remote_inferencing=false`.\n", |
26 | | - ":::" |
| 22 | + ":::\n" |
27 | 23 | ] |
28 | 24 | }, |
29 | 25 | { |
|
114 | 110 | " display(accumulated_output)\n" |
115 | 111 | ] |
116 | 112 | }, |
| 113 | + { |
| 114 | + "cell_type": "markdown", |
| 115 | + "metadata": {}, |
| 116 | + "source": [ |
| 117 | + "## Toggling Remote Inferencing\n", |
| 118 | + "\n", |
| 119 | + "To enable/disable remote inferencing, you can run the cli command `guardrails configure` or modify your `~/.guardrailsrc`.\n", |
| 120 | + "\n", |
| 121 | + "\n" |
| 122 | + ] |
| 123 | + }, |
| 124 | + { |
| 125 | + "cell_type": "code", |
| 126 | + "execution_count": null, |
| 127 | + "metadata": { |
| 128 | + "vscode": { |
| 129 | + "languageId": "shellscript" |
| 130 | + } |
| 131 | + }, |
| 132 | + "outputs": [], |
| 133 | + "source": [ |
| 134 | + "# To disable\n", |
| 135 | + "guardrails configure --disable-remote-inferencing\n", |
| 136 | + "\n", |
| 137 | + "# To enable\n", |
| 138 | + "guardrails configure --enable-remote-inferencing" |
| 139 | + ] |
| 140 | + }, |
| 141 | + { |
| 142 | + "cell_type": "markdown", |
| 143 | + "metadata": {}, |
| 144 | + "source": [ |
| 145 | + "To disable remote inferencing from a specific validator, you can add a `use_local` kwarg to the validator's initializer\n", |
| 146 | + "\n", |
| 147 | + ":::note\n", |
| 148 | + "When runnning locally, you may need to reinstall the validator with the --install-local-models flag.\n", |
| 149 | + ":::" |
| 150 | + ] |
| 151 | + }, |
| 152 | + { |
| 153 | + "cell_type": "code", |
| 154 | + "execution_count": null, |
| 155 | + "metadata": {}, |
| 156 | + "outputs": [], |
| 157 | + "source": [ |
| 158 | + "from guardrails import Guard, install\n", |
| 159 | + "try:\n", |
| 160 | + " from guardrails.hub import ToxicLanguage\n", |
| 161 | + "except ImportError:\n", |
| 162 | + " install(\"hub://guardrails/toxic_language\", install_local_models=True)\n", |
| 163 | + " from guardrails.hub import ToxicLanguage\n", |
| 164 | + "\n", |
| 165 | + "# uses validator locally.\n", |
| 166 | + "guard.use(ToxicLanguage(use_local=True))\n" |
| 167 | + ] |
| 168 | + }, |
117 | 169 | { |
118 | 170 | "cell_type": "markdown", |
119 | 171 | "metadata": {}, |
|
143 | 195 | "cell_type": "markdown", |
144 | 196 | "metadata": {}, |
145 | 197 | "source": [ |
| 198 | + ":::note\n", |
| 199 | + "\n", |
| 200 | + "Contact us to host validators in your own VPC with managed hardware.\n", |
| 201 | + "\n", |
| 202 | + ":::\n", |
| 203 | + "\n", |
| 204 | + "# Learn more\n", |
| 205 | + "\n", |
146 | 206 | "To learn more about hosting your own validators, check out the [Host Remote Validator Models doc](/docs/how_to_guides/hosting_validator_models).\n", |
147 | 207 | "\n", |
148 | 208 | "To learn more about writing your own validators, check out the [Custom validators doc](/docs/how_to_guides/custom_validator)." |
|
0 commit comments