Skip to content

RxInferClient.py Example Fails with ConnectionRefusedError When Server Isn't Running #8

Open
@ActiveInferenceInstitute

Description

Running the example Python client script support/server/RxInferClient.py fails with a ConnectionRefusedError if the corresponding RxInfer server is not running or is not accessible at the default address (http://localhost:8000/v1).

Here is the exact code I am running (side comment, having the pip install rxinferclient would be helpful in the readme).

The main issue here is that even with the localhost commented out, I am still getting connection error with the RxInferClient() issue.

# to install
# python3 -m pip install rxinferclient 

from rxinferclient import RxInferClient

# Initialize with default settings (auto-generates API key)
client = RxInferClient()

# Or initialize with custom server URL
# client = RxInferClient(server_url="http://localhost:8000/v1")

# Or initialize with your own API key
# client = RxInferClient(api_key="your-api-key")

# Ping the server to check if it's running
response = client.server.ping_server()
print(response.status)  # 'ok'

# Create a model instance
response = client.models.create_model_instance({ 
    "model_name": "BetaBernoulli-v1"
})
instance_id = response.instance_id

# Delete the model instance when done
client.models.delete_model_instance(instance_id=instance_id)

Ideally, the script should either:

  • Have the base RxInferClient() method more effectively find default remote sever.
  • Fail with a more specific error message clearly stating that the connection to the RxInfer server failed and indicating the required prerequisite or local steps to take.
  • Or, the example script/documentation should explicitly state that a running RxInfer server instance at the specified (or default) address is required before running the client script.

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