Commit 10865d8
committed
feat: add deployment model classes (#584)
## Summary
Add deployment model classes for different index deployment
configurations.
Closes SDK-103
## Classes
| Class | Deployment Type | Key Parameters |
|-------|-----------------|----------------|
| `ServerlessDeployment` | `serverless` | `cloud`, `region` |
| `ByocDeployment` | `byoc` | `environment` |
| `PodDeployment` | `pod` | `environment`, `pod_type`, `replicas`,
`shards` |
## Usage Example
```python
from pinecone import ServerlessDeployment, ByocDeployment, PodDeployment
# Serverless deployment
pc.create_index(
name="my-index",
schema=schema,
deployment=ServerlessDeployment(cloud="aws", region="us-east-1"),
)
# BYOC deployment
pc.create_index(
name="my-index",
schema=schema,
deployment=ByocDeployment(environment="aws-us-east-1-b92"),
)
# Pod deployment
pc.create_index(
name="my-index",
schema=schema,
deployment=PodDeployment(
environment="us-east-1-aws",
pod_type="p1.x1",
replicas=2,
),
)
```
## Test Plan
- [x] Unit tests for ServerlessDeployment serialization
- [x] Unit tests for ByocDeployment serialization
- [x] Unit tests for PodDeployment with various options
- [x] mypy type checking passes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: this PR only adds new model/dataclass types and exports
them; it doesn’t change existing request flows, but downstream code may
start relying on the new `to_dict` serialization format.
>
> **Overview**
> Adds new deployment configuration dataclasses (`ServerlessDeployment`,
`ByocDeployment`, `PodDeployment`) with `to_dict()` serialization and a
`Deployment` union type in `db_control/models/deployment.py`.
>
> Exports these types through `pinecone.db_control.models` and top-level
`pinecone` lazy imports, and adds unit tests validating constructor
defaults and `to_dict()` output across deployment variants.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c2e965d. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 9dcb0ff commit 10865d8
3 files changed
Lines changed: 388 additions & 1 deletion
File tree
- codegen
- pinecone/db_control
- tests/unit/db_control
Submodule apis updated from d5ac931 to 4eac4da
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
364 | 495 | | |
365 | 496 | | |
366 | 497 | | |
| |||
0 commit comments