Commit graph

14 commits

Author SHA1 Message Date
Ashwin Bharambe
0944b6a734 fix(mypy): use correct OpenAIChatCompletionChunk import in vllm
Import OpenAIChatCompletionChunk from llama_stack.apis.inference
instead of aliasing from openai package to match parent class signature.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:14:49 -07:00
Ashwin Bharambe
7e37790647 fix(mypy): resolve OpenAI SDK NotGiven/Omit type mismatches
Refactor embeddings API calls to avoid NotGiven/Omit type incompatibility
by conditionally building kwargs dict with only non-None parameters.

- openai_mixin.py: Build kwargs conditionally for embeddings.create()
- gemini.py: Apply same pattern + add Any import

This approach avoids type:ignore comments by not passing NOT_GIVEN sentinel
values that conflict with Omit type annotations in OpenAI SDK.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:12:59 -07:00
Ashwin Bharambe
382900d7a8 fix(mypy): resolve routes and type narrowing errors
- routes.py: Use type ignore for intentional None endpoint
- routes.py: Handle optional route.methods with fallback to empty list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:08:24 -07:00
Ashwin Bharambe
a40af5b91b fix(mypy): resolve union type and list annotation errors
- batches.py: Fix bytes/memoryview union type narrowing issue
- encoder_utils.py: Add type annotation for masks_list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:04:59 -07:00
Ashwin Bharambe
d612924f5b fix(mypy): resolve additional type errors in batches and together
- batches.py: Fix 6 cascading errors from body variable shadowing
- together.py: Add type casts for Together API integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:01:56 -07:00
Ashwin Bharambe
bcf3289785 fix(mypy): resolve provider utility and testing type issues
Fixes mypy type errors across provider utilities and testing infrastructure (Phase 2e):

- mcp.py (2 errors fixed):
  - Cast sse_client to Any to handle incompatible signatures with streamablehttp_client
  - Wrap ImageContent data in _URLOrData(data=...) for proper ImageContentItem construction

- batches.py (1 error fixed):
  - Rename walrus operator variable from `body` to `request_body` to avoid shadowing
    the file content `body` variable (bytes|memoryview) defined earlier in scope

- api_recorder.py (1 error fixed):
  - Cast Pydantic field annotation assignment to proper type when monkey-patching
    OpenAI CompletionChoice model to accept None in finish_reason

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 22:53:48 -07:00
Ashwin Bharambe
257eaeb945 fix(mypy): resolve model implementation typing issues
Fixes type errors across 4 model implementation files (Phase 2d):

- image_transform.py: Fix return type annotations and variable shadowing
  - Changed find_supported_resolutions return type from Tensor to list[tuple[int, int]]
  - Changed resize_without_distortion parameter/return from Tensor to Image.Image
  - Use separate variable names for list vs tensor (possible_resolutions_list/tensor)

- checkpoint.py: Replace deprecated torch.BFloat16Tensor usage
  - Use torch.set_default_dtype(torch.bfloat16) instead of deprecated tensor types
  - Rename ckpt_paths to ckpt_paths_array to avoid variable shadowing

- hadamard_utils.py: Add type assertion for nn.Linear
  - Assert isinstance check to narrow type from Module to Linear before accessing in_features

- encoder_utils.py: Fix variable shadowing
  - Use masks_list for list accumulation, masks for final Tensor result

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 22:35:24 -07:00
Ashwin Bharambe
f34b6288cc fix(mypy): resolve type issues in MongoDB, batches, and auth providers
Resolves typing issues across provider utilities:

**MongoDB (6 errors fixed):**
- Fix AsyncMongoClient parameter dict unpacking by building typed dict with None filtering
- Fix AsyncCursor synchronous iteration - use async for loop

**Batches (1 error fixed):**
- Handle memoryview|bytes union type for file content decoding

**Auth Providers (4 errors fixed):**
- Add missing Any import
- Ensure JWKS URI is not None with validation
- Only pass lifespan parameter when configured (let library use its default)
- Conditionally build httpx post kwargs to avoid passing None for auth

Fixes 11 mypy type errors in provider utility layer.
2025-10-27 21:26:29 -07:00
Ashwin Bharambe
41a65b87e6 fix(mypy): resolve SQLAlchemy typing issues in sqlalchemy_sqlstore.py
Fix all 7 mypy type checking errors in SQLAlchemy store implementation without using suppressions.

**Changes:**
- Add `cast()` import for type assertions
- Use `cast(ColumnElement[Any], ...)` for all comparison operators in `_build_where_expr()`
  - Handles ==, >, <, >=, <= operators
- Remove unnecessary `rowcount` check before iteration
  - SQLAlchemy Result can be iterated directly
  - Empty results yield empty list naturally

**Errors fixed:**
- 6 `no-any-return` errors in _build_where_expr (comparison operators)
- 1 `attr-defined` error (Result.rowcount)

**Testing:**
```bash
uv run mypy src/llama_stack/providers/utils/sqlstore/sqlalchemy_sqlstore.py
# Success: no issues found
```
2025-10-27 21:12:40 -07:00
Ashwin Bharambe
6e47335371 fix(mypy): resolve OpenTelemetry typing issues in telemetry.py
Fix all 11 mypy errors in telemetry.py without using suppressions:

**Changes:**
- Add type aliases for OpenTelemetry attribute types (AttributeValue, Attributes)
- Create `_clean_attributes()` helper to filter None values from attribute dicts
- Use `cast()` for TracerProvider methods (add_span_processor, force_flush)
- Use `cast()` for metric creation methods returning from global storage
- Fix variable reuse by renaming `span` to `end_span` in SpanEndPayload branch
- Add None check for parent_span before set_span_in_context

**Errors fixed:**
- TracerProvider attribute access (2 errors)
- Counter/UpDownCounter/ObservableGauge return types (3 errors)
- Attribute dict type mismatches (4 errors)
- Span assignment type conflicts (2 errors)

This eliminates all mypy errors in the telemetry module.
2025-10-27 21:12:19 -07:00
ehhuang
b7dd3f5c56
chore!: BREAKING CHANGE: vector_db_id -> vector_store_id (#3923)
# What does this PR do?


## Test Plan
CI
vector_io tests will fail until next client sync

passed with
https://github.com/llamastack/llama-stack-client-python/pull/286 checked
out locally
2025-10-27 14:26:06 -07:00
Nathan Weinberg
b6954c9882
fix: add missing shutdown methods to PromptServiceImpl and ConversationServiceImpl (#3925)
Change is visible in server shutdown logs, changes `WARNING` loglines to
`INFO`

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
2025-10-27 13:41:38 -07:00
Matthew Farrellee
a9b00db421
feat: add provider data keys for Cerebras, Databricks, NVIDIA, and RunPod (#3734)
# What does this PR do?

add provider-data key passing support to Cerebras, Databricks, NVIDIA
and RunPod

also, added missing tests for Fireworks, Anthropic, Gemini, SambaNova,
and vLLM

addresses #3517 

## Test Plan

ci w/ new tests

---------

Co-authored-by: Ashwin Bharambe <ashwin.bharambe@gmail.com>
2025-10-27 13:09:35 -07:00
Ashwin Bharambe
471b1b248b
chore(package): migrate to src/ layout (#3920)
Migrates package structure to src/ layout following Python packaging
best practices.

All code moved from `llama_stack/` to `src/llama_stack/`. Public API
unchanged - imports remain `import llama_stack.*`.

Updated build configs, pre-commit hooks, scripts, and GitHub workflows
accordingly. All hooks pass, package builds cleanly.

**Developer note**: Reinstall after pulling: `pip install -e .`
2025-10-27 12:02:21 -07:00