diff --git a/.changeset/dull-seahorses-kneel.md b/.changeset/dull-seahorses-kneel.md new file mode 100644 index 0000000..1cb0ab2 --- /dev/null +++ b/.changeset/dull-seahorses-kneel.md @@ -0,0 +1,5 @@ +--- +'function-gpt': patch +--- + +fix exports and readme example diff --git a/README.md b/README.md index d215bcd..11e9651 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,17 @@ [![codecov](https://codecov.io/gh/atinylittleshell/function-gpt/graph/badge.svg?token=1R81CX1Z14)](https://codecov.io/gh/atinylittleshell/function-gpt) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/atinylittleshell/function-gpt/blob/main/license) -- Requires typescript - Leverages the official [openai](https://www.npmjs.com/package/openai) npm package for communicating with OpenAI's API -- Automatically generate function calling JSON schema from decorated typescript classes +- Uses typescript decorators to provide metadata for function calling +- Automatically generate function calling JSON schema from decorated typescript functions - Automatically parse function calling response - Automatically call functions and send back results to OpenAI ## Example ```typescript +import { gptFunction, gptObjectField, ChatGPTSession } from 'function-gpt'; + // First create your own class that extends ChatGPTSession. class BrowseSession extends ChatGPTSession { // Define functions that you want to provide to ChatGPT for function calling. diff --git a/package.json b/package.json index 9566b1d..e2266fa 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,14 @@ "function calling" ], "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", "exports": { - "import": { - "default": "./dist/index.js", + ".": { + "require": "./dist/index.cjs", + "import": "./dist/index.js", "types": "./dist/index.d.ts" - }, - "require": { - "default": "./dist/index.cjs", - "types": "./dist/index.d.cts" } }, "files": [