Instructions to use Wellz1000/hermes-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- HERMES
How to use Wellz1000/hermes-2 with HERMES:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download web/src/lib/nested.ts from Wellz1000/hermes-2: direct link, hf CLI and curl.
- Browser
- Download file 825 Bytes
-
https://huggingface.co/Wellz1000/hermes-2/resolve/main/web/src/lib/nested.ts
- Command line
-
hf download hf://Wellz1000/hermes-2/web/src/lib/nested.ts
-
curl -L -o nested.ts https://huggingface.co/Wellz1000/hermes-2/resolve/main/web/src/lib/nested.ts
825 Bytes
| export function getNestedValue(obj: Record<string, unknown>, path: string): unknown { | |
| const parts = path.split("."); | |
| let cur: unknown = obj; | |
| for (const p of parts) { | |
| if (cur == null || typeof cur !== "object") return undefined; | |
| cur = (cur as Record<string, unknown>)[p]; | |
| } | |
| return cur; | |
| } | |
| export function setNestedValue(obj: Record<string, unknown>, path: string, value: unknown): Record<string, unknown> { | |
| const clone = structuredClone(obj); | |
| const parts = path.split("."); | |
| let cur: Record<string, unknown> = clone; | |
| for (let i = 0; i < parts.length - 1; i++) { | |
| if (cur[parts[i]] == null || typeof cur[parts[i]] !== "object") { | |
| cur[parts[i]] = {}; | |
| } | |
| cur = cur[parts[i]] as Record<string, unknown>; | |
| } | |
| cur[parts[parts.length - 1]] = value; | |
| return clone; | |
| } | |