github / github/copilot-sdk

Feature Request: Add `toolChoice` Parameter for Tool Selection Control

Đang mở
#23 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement wishlist
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
127

Mô tả

## Summary

Add a `toolChoice` parameter to control how the model selects tools, similar to the [Vercel AI SDK](https://github.com/vercel/ai).

## Proposed Type

```typescript
type ToolChoice = 'auto' | 'none' | 'required' | { type: 'tool'; toolName: string };
```

| Value | Behavior |
|-------|----------|
| `auto` | Model decides whether to call tools (default) |
| `none` | Model must not call any tools |
| `required` | Model must call at least one tool |
| `{ type: 'tool', toolName }` | Model must call the specified tool |

## Usage Example

```typescript
// Force tool usage
await session.send({
prompt: "What's the weather in Seattle?",
toolChoice: "required"
});

// Prevent tool usage
await session.send({
prompt: "Explain how weather forecasting works",
toolChoice: "none"
});

// Force specific tool
await session.send({
prompt: "Get Seattle weather",
toolChoice: { type: "tool", toolName: "get_weather" }
});
```

## Reference

- Vercel AI SDK: [toolChoice docs](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling)
- OpenAI: [tool_choice parameter](https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice)

## Contribution

I'm willing to implement the SDK changes (types, session.send, tests, docs) once backend support is confirmed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.