Skip to content

Space_id required to use agent-builder ?? #16

@jpradier

Description

@jpradier

Trying to use agent-builder, I am facing the following issue:
I am receiving a Internal Server Error when trying to call /chat/completions. In the logs, I have the following issue:

2025-03-17 12:09:58,520 - root - INFO - Calling AI service with payload: {'messages': [{'role': 'user', 'content': 'Quel temps fait-il à Paris ?', 'tool_calls': None, 'tool_call_id': None}]}
2025-03-17 12:09:58,520 - ibm_watsonx_ai.wml_client_error - WARNING - You must set the space/project id. Use `client.set.default_space(<SPACE_UID>)`/`client.set.default_project(<PROJECT_UID>)` to proceed.
2025-03-17 12:09:58,520 - ibm_watsonx_ai.wml_client_error - DEBUG - You must set the space/project id. Use `client.set.default_space(<SPACE_UID>)`/`client.set.default_project(<PROJECT_UID>)` to proceed.
INFO:     192.168.127.1:37220 - "POST /chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 714, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 734, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/app.py", line 56, in chat_completions
    all_messages = get_llm_sync(request.messages)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/utils.py", line 70, in get_llm_sync
    result = client.deployments.run_ai_service(WATSONX_DEPLOYMENT_ID, payload)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ibm_watsonx_ai/deployments.py", line 2053, in run_ai_service
    params=self._client._params(),  # version parameter is mandatory
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ibm_watsonx_ai/client.py", line 629, in _params
    raise WMLClientError(
ibm_watsonx_ai.wml_client_error.WMLClientError: You must set the space/project id. Use `client.set.default_space(<SPACE_UID>)`/`client.set.default_project(<PROJECT_UID>)` to proceed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions