{"id":13645633,"url":"https://github.com/atinylittleshell/function-gpt","last_synced_at":"2025-03-17T11:30:55.102Z","repository":{"id":189413062,"uuid":"679359969","full_name":"atinylittleshell/function-gpt","owner":"atinylittleshell","description":"This is a typescript library that helps handle function calling with OpenAI's ChatGPT API.","archived":false,"fork":false,"pushed_at":"2023-11-07T23:56:32.000Z","size":170,"stargazers_count":43,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T20:15:31.242Z","etag":null,"topics":["api","chatgpt","function-calling","gpt","openai","typescript"],"latest_commit_sha":null,"homepage":"","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/atinylittleshell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2023-08-16T16:57:29.000Z","updated_at":"2025-03-11T11:59:44.000Z","dependencies_parsed_at":"2024-01-14T10:01:00.566Z","dependency_job_id":"52197a3b-aea8-4154-8480-6b56f2c6b72c","html_url":"https://github.com/atinylittleshell/function-gpt","commit_stats":null,"previous_names":["atinylittleshell/function-gpt"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinylittleshell%2Ffunction-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinylittleshell%2Ffunction-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinylittleshell%2Ffunction-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atinylittleshell%2Ffunction-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atinylittleshell","download_url":"https://codeload.github.com/atinylittleshell/function-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639558,"owners_count":20323510,"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","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":["api","chatgpt","function-calling","gpt","openai","typescript"],"created_at":"2024-08-02T01:02:38.787Z","updated_at":"2025-03-17T11:30:54.745Z","avatar_url":"https://github.com/atinylittleshell.png","language":"TypeScript","readme":"# Function-GPT\n\n\u003e This is a typescript library that helps handle [function calling](https://platform.openai.com/docs/guides/gpt/function-calling) with OpenAI.\n\n[![NPM](https://img.shields.io/npm/v/function-gpt.svg)](https://www.npmjs.com/package/function-gpt)\n[![Build Status](https://github.com/atinylittleshell/function-gpt/actions/workflows/publish.yml/badge.svg)](https://github.com/atinylittleshell/function-gpt/actions/workflows/publish.yml)\n[![codecov](https://codecov.io/gh/atinylittleshell/function-gpt/graph/badge.svg?token=1R81CX1Z14)](https://codecov.io/gh/atinylittleshell/function-gpt)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/atinylittleshell/function-gpt/blob/main/license)\n\n- Uses typescript decorators to provide metadata for function calling\n- Automatically generate function calling JSON schema from decorated typescript functions\n- Automatically call functions based on name and JSON-formatted arguments\n- Can be used with OpenAI's Chat Completion API as well as the Assistants API\n\n## Example\n\n```typescript\nimport { gptFunction, gptString, FunctionCallingProvider } from 'function-gpt';\n\n// Define the type of the input parameter for functions above.\nclass BrowseParams {\n  // Decorate each field with @gptObjectField to provide necessary metadata.\n  @gptString('url of the web page to browse')\n  public url!: string;\n}\n\n// Create your own class that extends FunctionCallingProvider.\nclass BrowseProvider extends FunctionCallingProvider {\n  // Define functions that you want to provide to OpenAI for function calling.\n  // Decorate each function with @gptFunction to provide necessary metadata.\n  // The function should accept a single parameter that is a typed object.\n  @gptFunction('make http request to a url and return its html content', BrowseParams)\n  async browse(params: BrowseParams) {\n    const response = await fetch(params.url);\n    return await response.text();\n  }\n}\n\nconst provider = new BrowseProvider();\n\nconst schema = await provider.getSchema();\nconst result = await provider.handleFunctionCall(\n  'browse',\n  JSON.stringify({ url: 'https://www.google.com' }),\n);\n```\n\n## API References\n\nSee [API references](./doc/README.md) for more detailed information on how to use the library.\n\n## Installation\n\n```bash\nnpm install function-gpt --save\n# or\nyarn add function-gpt\n# or\npnpm add function-gpt\n```\n\n## Contributing\n\nContributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for more info.\n","funding_links":[],"categories":["Openai"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatinylittleshell%2Ffunction-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatinylittleshell%2Ffunction-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatinylittleshell%2Ffunction-gpt/lists"}