{"id":15462676,"url":"https://github.com/devidw/functhem","last_synced_at":"2025-09-07T22:42:42.046Z","repository":{"id":238565471,"uuid":"796829280","full_name":"devidw/functhem","owner":"devidw","description":"ease the integration of hermes function calling prompt format into typescript ecosystem with typed function calls","archived":false,"fork":false,"pushed_at":"2024-05-06T17:55:41.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-30T15:27:39.050Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/functhem","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devidw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-06T17:55:39.000Z","updated_at":"2025-07-28T11:03:09.000Z","dependencies_parsed_at":"2024-05-06T19:06:32.817Z","dependency_job_id":"53c4d360-f25e-41d2-9464-d8241385d749","html_url":"https://github.com/devidw/functhem","commit_stats":null,"previous_names":["devidw/funcall"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devidw/functhem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devidw%2Ffuncthem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devidw%2Ffuncthem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devidw%2Ffuncthem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devidw%2Ffuncthem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devidw","download_url":"https://codeload.github.com/devidw/functhem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devidw%2Ffuncthem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274107987,"owners_count":25223473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T00:03:20.381Z","updated_at":"2025-09-07T22:42:42.018Z","avatar_url":"https://github.com/devidw.png","language":"TypeScript","readme":"\u003ch1 align=center\u003e\n    functhem\n\u003c/h1\u003e\n\nease the integration of [hermes function calling prompt format](https://github.com/NousResearch/Hermes-Function-Calling#prompt-format-for-function-calling)\ninto typescript ecosystem with typed function calls\n\n## what it can do\n\n- generate system message prompt with your defined tools, zod to json schema\n- parse tool call output -\u003e typed\n\n## installation\n\n```console\npnpm add functhem\n```\n\n## usage\n\n```ts\nimport { z } from \"zod\"\nimport { Tool, Functhem } from \"functhem\"\n\nconst happySchema = z.object({\n  name: z.literal(\"isHappy\"),\n  arguments: z.object({\n    isHappy: z.boolean(),\n  }),\n})\n\nconst happyTool = new Tool\u003ctypeof happySchema\u003e({\n  name: \"isHappy\",\n  description: \"Is the user happy?\",\n  schema: happySchema,\n})\n\nconst movieSchema = z.object({\n  name: z.literal(\"watchMovie\"),\n  arguments: z.object({\n    genre: z.string(),\n  }),\n})\n\nconst movieTool = new Tool\u003ctypeof movieSchema\u003e({\n  name: \"watchMovie\",\n  description:\n    \"Does the user express that they want to see a movie, if so, which genre?\",\n  schema: movieSchema,\n})\n\nconst functhem = new Functhem([happyTool, movieTool])\n\nconst sysMsg = functhem.getSysMsg()\n\nconst output = await yourInferenceFunction({\n    messages: [\n      {\n        role: \"system\",\n        content: functhem.getSysMsg(), // \u003c-- HERE\n      },\n      {\n        role: \"user\",\n        content: `Input: so stressed, just want to see a funny movie\\nProcess the user input with your tools.`,\n      },\n    ],\n})\n\nconst outCalls = functhem.parseOut(output) // \u003c-- HERE\n\noutCalls.forEach((one) =\u003e {\n  switch (one.name) {\n    case \"isHappy\": {\n      console.log(one.arguments.isHappy)\n      break\n    }\n    case \"watchMovie\": {\n      console.log(one.arguments.genre)\n      break\n    }\n  }\n})\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevidw%2Ffuncthem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevidw%2Ffuncthem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevidw%2Ffuncthem/lists"}