Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Run a round's tool calls at once

Đang mở
#359 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Công nghệ
swift
Lĩnh vực
ai, backend

Hướng nghiên cứu

Start by reading the OpenAI provider's tool-call loop and the fork at gtokman/AnyLanguageModel@3bc39af. The issue leaves key design choices open: provider scope, whether concurrency is opt-in, cancellation behavior, and interaction with parallel_tool_calls. Done means agreeing on those behaviors and implementing concurrent calls while preserving result order and delegate callbacks.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

When a model calls several tools in one round, the providers run the calls one after another, so a round takes the sum of its calls' times. The calls can't depend on each other's results, because the model wrote all of them before seeing any output, so they could run at once and the round would take as long as its slowest call.

In our chat server (OpenAI Chat Completions through Vercel AI Gateway; the model often looks up several places or sites at once), this was most of the wait in multi-call rounds. We run a fork with the OpenAI provider's calls running concurrently: gtokman/AnyLanguageModel@3bc39af. It keeps what callers see the same:

  • results go back in the order the model gave the calls, both in the transcript and in the next request;
  • the delegate hears about each call as before (didGenerateToolCalls, toolCallDecision, and the per-call results);
  • the first error ends the round.

Two 300 ms calls in one round took 0.32 s instead of 0.62 s. In our server's benchmark, the median multi-call round went from 6.5 s to 1.3 s.

Before opening a PR, some questions for you:

  1. All providers, or opt-in? Our fork only changes the OpenAI provider. Upstream it probably belongs in every provider's tool loop, maybe through shared code. But some apps' tools may not be safe to run concurrently (shared state, rate limits, side effects that must happen in order). Should it be the default, a GenerationOptions setting, or something on the tool, such as a way to mark a tool as safe to run alongside others?
  2. Cancellation: when one call throws, should the others be cancelled, or allowed to finish before the error is reported? Our fork reports the first error; a tool with side effects might want its siblings to finish.
  3. OpenAI's parallel_tool_calls: it controls whether the model may request several calls in a round. This would be about running them. Should a setting for one affect the other?

Happy to do the PR in whichever shape you prefer.

Ngôn ngữ chính
Swift
Star
959
Fork
99
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
57

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của huggingface/AnyLanguageModel

Tất cả issue của huggingface/AnyLanguageModel

Issue tương tự

Thêm issue về Swift

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.