Feature Request: Add async support for Generative AI Inference client
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
Hướng nghiên cứu
Bắt đầu bằng việc xem xét PR #835 và client Generative AI Inference đồng bộ hiện có sử dụng requests. So sánh client async được đề xuất, 15 unit test và 7 integration test của client này với các yêu cầu hỗ trợ chat, streaming, embeddings, xác thực và context manager. Được xem là hoàn tất khi các thao tác bất đồng bộ được yêu cầu đã được bao phủ và các phiên bản Python cùng các model được nêu vẫn được hỗ trợ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Feature Request
Description
Add native async/await support for the OCI Generative AI Inference client to enable non-blocking concurrent requests in async applications.
Problem Statement
The current SDK uses synchronous HTTP requests via the requests library. This causes issues in async applications:
- Event loop blocking: Sync calls block the event loop in FastAPI, async agents, and other async frameworks
- Limited concurrency: Cannot efficiently make concurrent API calls
- Performance bottleneck: Sequential requests are significantly slower than concurrent alternatives
Proposed Solution
Add an AsyncGenerativeAiInferenceClient class that:
- Uses
aiohttpfor true async HTTP requests - Reuses the existing OCI
Signerfor authentication - Provides async versions of all GenAI operations (chat, streaming, embeddings, etc.)
- Supports async context manager pattern
Example Usage
import asyncio
from oci.generative_ai_inference import AsyncGenerativeAiInferenceClient
async def main():
async with AsyncGenerativeAiInferenceClient(config) as client:
# Concurrent requests - 3x faster than sequential
results = await asyncio.gather(
client.chat(details1),
client.chat(details2),
client.chat(details3),
)
asyncio.run(main())
Performance Impact
Testing shows 2-3.5x throughput improvement for concurrent workloads:
| Scenario | Sequential | Concurrent | Speedup |
|---|---|---|---|
| 3 requests (Llama 3.3) | 1.30s | 0.64s | 2.01x |
| 3 requests (Llama 3.2) | 1.40s | 0.44s | 3.18x |
| 3 requests (Cohere) | 0.50s | 0.14s | 3.54x |
Use Cases
- FastAPI/async web frameworks: Non-blocking GenAI calls in async endpoints
- LangChain agents: Concurrent tool calls and chain execution
- Batch processing: Parallel processing of multiple prompts
- Real-time applications: Low-latency streaming responses
Implementation
A reference implementation is provided in PR #835 with:
- Full async client implementation
- 15 unit tests
- 7 integration tests
- Tested on Python 3.9, 3.12, 3.13, 3.14
- Tested with 6 different models
Related
- PR: #835
- Ngôn ngữ chính
- Python
- Star
- 473
- Fork
- 322
- Merge trung bình
- 13 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của oracle/oci-python-sdk
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
oracle/oci-python-sdk#890 · 3 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
oracle/oci-python-sdk#879 · 3 bình luận ·
-
Example uses non-existent APICó thể đã có người làm @reginaldalfret đã nhận 9 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
oracle/oci-python-sdk#878 ·
-
SDK
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
oracle/oci-python-sdk#861 · 5 bình luận ·
-
SDK
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
oracle/oci-python-sdk#852 ·
Tất cả issue của oracle/oci-python-sdk
Issue tương tự
-
`LazyFrameRemote` and `ExecuteRemote` sinks do not accept `Path`, like `LazyFrame` sinks do.Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
WingedGuardian/GENesis-AGI#3375 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
curriculum documentation quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
githubnext/gh-aw-workshop#4601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
approved Good First Issue scope: docs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
hiero-ledger/hiero-sdk-python#2730 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày