open-index/open-npm huggingface dataset:
npm package: @plucky-ai/react
Description: A React hook for using the Plucky Chat SDK. Access the full docs [here](https://docs.plucky.ai).
Latest version: 0.7.0

# @plucky-ai/react

A React hook for using the Plucky Chat SDK. Access the full docs [here](https://docs.plucky.ai).

## Installation

```bash
npm install @plucky-ai/react
# or
yarn add @plucky-ai/react
# or
pnpm add @plucky-ai/react
```

## Usage

```tsx
import { useTools } from '@plucky-ai/react'

function MyComponent(props: { temperature: number }) {
  useTools({
    context: {
      temperature,
    },
    tools: [
      {
        name: 'get_current_weather',
        description: 'Get the current weather',
        defaultLoadingText: 'Checking the weather...',
        defaultSuccessText: 'Weather retrieved.',
        cb: async (_, { temperature }) => {
          // Return a string:
          return `It's currently ${temperature} degrees.`

          // Or return an object with custom success text:
          // return {
          //   content: `It's currently ${temperature} degrees.`,
          //   successText: `Weather: ${temperature}°`,
          // }
        },
      },
    ],
  })

  return <div>My component content here</div>
}
```