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/session-import.ts from Wellz1000/hermes-2: direct link, hf CLI and curl.
- Browser
- Download file 1.55 kB
-
https://huggingface.co/Wellz1000/hermes-2/resolve/main/web/src/lib/session-import.ts
- Command line
-
hf download hf://Wellz1000/hermes-2/web/src/lib/session-import.ts
-
curl -L -o session-import.ts https://huggingface.co/Wellz1000/hermes-2/resolve/main/web/src/lib/session-import.ts
1.55 kB
| import type { SessionImportResponse } from "@/lib/api"; | |
| export type ImportableSession = Record<string, unknown>; | |
| function normalizeImportSessions(value: unknown): ImportableSession[] { | |
| const candidate = | |
| value && | |
| typeof value === "object" && | |
| !Array.isArray(value) && | |
| Array.isArray((value as { sessions?: unknown }).sessions) | |
| ? (value as { sessions: unknown[] }).sessions | |
| : Array.isArray(value) | |
| ? value | |
| : [value]; | |
| const sessions = candidate.filter( | |
| (item): item is ImportableSession => | |
| !!item && typeof item === "object" && !Array.isArray(item), | |
| ); | |
| if (sessions.length !== candidate.length) { | |
| throw new Error("Expected exported session JSON or JSONL"); | |
| } | |
| return sessions; | |
| } | |
| export function parseImportSessions(text: string): ImportableSession[] { | |
| const trimmed = text.trim(); | |
| if (!trimmed) throw new Error("File is empty"); | |
| try { | |
| return normalizeImportSessions(JSON.parse(trimmed)); | |
| } catch (jsonError) { | |
| const lines = trimmed.split(/\r?\n/).filter((line) => line.trim()); | |
| if (lines.length <= 1) throw jsonError; | |
| return normalizeImportSessions(lines.map((line) => JSON.parse(line))); | |
| } | |
| } | |
| export function importSummary(result: SessionImportResponse): string { | |
| const parts = [`${result.imported} imported`]; | |
| if (result.skipped > 0) parts.push(`${result.skipped} skipped`); | |
| if (result.detached > 0) { | |
| parts.push(`${result.detached} detached from missing parents`); | |
| } | |
| return parts.join("; "); | |
| } | |