Azure / Azure/azureml-examples

NVIDIA NIM agent samples use removed AIProjectClient.from_connection_string (broken on current azure-ai-projects)

Open
#4,072 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
2k
Forks
1.7k
Avg merge
18h 18m
Merged PRs (30d)
2

Description

### Which sample(s) are affected?

`sdk/python/foundation-models/nvidia-nim-agent-samples/`:
- `nvidia_nim_no_tools.py`
- `nvidia_nim_file_search.py`
- `nvidia_nim_codeinterpreter.py`
- `README`

### Describe the problem

All three NVIDIA NIM agent samples construct the client with the removed factory method:

```python
project_client = AIProjectClient.from_connection_string(
credential=DefaultAzureCredential(),
conn_str=os.environ["PROJECT_CONNECTION_STRING"],
)
```

`AIProjectClient.from_connection_string` was **removed in `azure-ai-projects` 1.0.0b11** (2025-05-15). CHANGELOG:

> The factory method `from_connection_string` was removed. Support for project connection string and hub-based projects has been discontinued.

The `README` tells users to `pip install azure-ai-projects azure-identity` (unpinned), which installs a current release, so the samples raise `AttributeError: type object 'AIProjectClient' has no attribute 'from_connection_string'` on a fresh install. Connection-string / hub-based projects are also discontinued, so a new Foundry project cannot supply `PROJECT_CONNECTION_STRING` at all.

### Why a simple version-pin is not sufficient

Pinning to `azure-ai-projects<1.0.0b11` makes the import work but leaves the samples un-runnable for new projects (no connection string available). The rest of each sample is written against the pre-1.0.0b11 API surface (`create_thread` / `create_message` / `create_and_process_run` / `list_messages`, tools imported from `azure.ai.projects.models`), which also changed. Note `azure-ai-projects` 2.0 further dropped the `azure-ai-agents` dependency and moved to the Responses/Conversations API.

### Suggested fix

Migrate the three samples to the current `azure-ai-projects>=2.0` API:
- Construct with `AIProjectClient(endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"], credential=DefaultAzureCredential())`.
- Replace the thread/message/run calls with the current Agents + Responses/Conversations flow (`agents.create_version`, `openai_client.conversations.create`, `openai_client.responses.create(...)`, etc.).
- Update the `README` install/prereqs to the endpoint-based auth and current package set.

Happy to open a PR if the maintainers confirm the preferred target API and a NIM Model Gateway test path.

Contributor guide

Open the contributing guide

Research direction

Read the README and the three affected scripts in sdk/python/foundation-models/nvidia-nim-agent-samples/, then verify the current azure-ai-projects 2.0 Agents and Responses/Conversations API. Migrate the samples to FOUNDRY_PROJECT_ENDPOINT authentication and update the README prerequisites. Done means all three samples use the current API and the installation instructions no longer require a project connection string.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
ai, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.