Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/docs/content/docs/api-reference/python.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from simstudio import SimStudioClient
# Initialize the client
client = SimStudioClient(
api_key="your-api-key-here",
base_url="https://www.sim.ai" # optional; the default https://sim.ai redirects to this host
base_url="https://www.sim.ai" # optional, defaults to https://www.sim.ai
)

# Execute a workflow
Expand All @@ -48,12 +48,12 @@ except Exception as error:
#### Constructor

```python
SimStudioClient(api_key: str, base_url: str = "https://sim.ai")
SimStudioClient(api_key: str, base_url: str = "https://www.sim.ai")
```

**Parameters:**
- `api_key` (str): Your Sim API key
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://sim.ai`, which redirects to `https://www.sim.ai`; set the `www` host explicitly)
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`; versions before 0.2.1 default to `https://sim.ai`, which redirects to `https://www.sim.ai`, so set the `www` host explicitly on older versions)

#### Methods

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/docs/api-reference/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
// Initialize the client
const client = new SimStudioClient({
apiKey: 'your-api-key-here',
baseUrl: 'https://www.sim.ai' // optional; the default https://sim.ai redirects to this host
baseUrl: 'https://www.sim.ai' // optional, defaults to https://www.sim.ai
});

// Execute a workflow
Expand All @@ -68,7 +68,7 @@ new SimStudioClient(config: SimStudioConfig)

**Configuration:**
- `config.apiKey` (string): Your Sim API key
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://sim.ai`, which redirects to `https://www.sim.ai`; set the `www` host explicitly)
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`; versions before 0.2.1 default to `https://sim.ai`, which redirects to `https://www.sim.ai`, so set the `www` host explicitly on older versions)

#### Methods

Expand Down
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/python-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ from simstudio import SimStudioClient
# Initialize the client
client = SimStudioClient(
api_key=os.getenv("SIM_API_KEY", "your-api-key-here"),
base_url="https://sim.ai" # optional, defaults to https://sim.ai
base_url="https://www.sim.ai" # optional, defaults to https://www.sim.ai
)

# Execute a workflow
Expand All @@ -51,11 +51,11 @@ except Exception as error:
#### Constructor

```python
SimStudioClient(api_key: str, base_url: str = "https://sim.ai")
SimStudioClient(api_key: str, base_url: str = "https://www.sim.ai")
```

- `api_key` (str): Your Sim API key
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://sim.ai`)
- `base_url` (str, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`)

#### Methods

Expand Down Expand Up @@ -408,7 +408,7 @@ from simstudio import SimStudioClient
# Using environment variables
client = SimStudioClient(
api_key=os.getenv("SIM_API_KEY"),
base_url=os.getenv("SIM_BASE_URL", "https://sim.ai")
base_url=os.getenv("SIM_BASE_URL", "https://www.sim.ai")
)
```

Expand Down
2 changes: 1 addition & 1 deletion packages/python-sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "simstudio-sdk"
version = "0.2.0"
version = "0.2.1"
authors = [
{name = "Sim", email = "help@sim.ai"},
]
Expand Down
6 changes: 3 additions & 3 deletions packages/python-sdk/simstudio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# rather than silently reporting True.
_SUCCESSFUL_RUN_STATUSES = ('completed', 'paused')

__version__ = "0.2.0"
__version__ = "0.2.1"


def _client_headers() -> Dict[str, str]:
Expand Down Expand Up @@ -140,10 +140,10 @@ class SimStudioClient:

Args:
api_key: Your Sim API key
base_url: Base URL for the Sim API (defaults to https://sim.ai)
base_url: Base URL for the Sim API (defaults to https://www.sim.ai)
"""

def __init__(self, api_key: str, base_url: str = "https://sim.ai"):
def __init__(self, api_key: str, base_url: str = "https://www.sim.ai"):
self.api_key = api_key
self.base_url = base_url.rstrip('/')
self._session = requests.Session()
Expand Down
10 changes: 5 additions & 5 deletions packages/python-sdk/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_simstudio_client_default_base_url():
"""Test SimStudioClient with default base URL."""
client = SimStudioClient(api_key="test-api-key")
assert client.api_key == "test-api-key"
assert client.base_url == "https://sim.ai"
assert client.base_url == "https://www.sim.ai"


def test_set_api_key():
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_validate_workflow_returns_false_on_error(mock_get):
result = client.validate_workflow("test-workflow-id")

assert result is False
mock_get.assert_called_once_with("https://sim.ai/api/workflows/test-workflow-id/status")
mock_get.assert_called_once_with("https://www.sim.ai/api/workflows/test-workflow-id/status")
Comment thread
waleedlatif1 marked this conversation as resolved.


def test_simstudio_error():
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_async_execution_returns_run_id(mock_post):
mock_response.json.return_value = {
"data": {
"runId": "execution-123",
"statusUrl": "https://sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
"statusUrl": "https://www.sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
}
}
mock_response.headers.get.return_value = None
Expand All @@ -146,11 +146,11 @@ def test_async_execution_returns_run_id(mock_post):

assert result.success is True
assert result.run_id == "execution-123"
assert result.status_url == "https://sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
assert result.status_url == "https://www.sim.ai/api/v2/workflows/workflow-id/runs/execution-123"
assert result.async_execution is True

call_args = mock_post.call_args
assert call_args.args[0] == "https://sim.ai/api/v2/workflows/workflow-id/execute"
assert call_args.args[0] == "https://www.sim.ai/api/v2/workflows/workflow-id/execute"
assert "X-Execution-Mode" not in call_args.kwargs["headers"]
assert call_args.kwargs["json"] == {
"input": {"message": "Hello"},
Expand Down
4 changes: 2 additions & 2 deletions packages/ts-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { SimStudioClient } from 'simstudio-ts-sdk';
// Initialize the client
const client = new SimStudioClient({
apiKey: 'your-api-key-here',
baseUrl: 'https://sim.ai' // optional, defaults to https://sim.ai
baseUrl: 'https://www.sim.ai' // optional, defaults to https://www.sim.ai
});

// Execute a workflow
Expand All @@ -57,7 +57,7 @@ new SimStudioClient(config: SimStudioConfig)
```

- `config.apiKey` (string): Your Sim API key
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://sim.ai`)
- `config.baseUrl` (string, optional): Base URL for the Sim API (defaults to `https://www.sim.ai`)

#### Methods

Expand Down
2 changes: 1 addition & 1 deletion packages/ts-sdk/examples/basic-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SimStudioClient, SimStudioError } from '../src/index'
async function basicExample() {
const client = new SimStudioClient({
apiKey: process.env.SIM_API_KEY!,
baseUrl: 'https://sim.ai',
baseUrl: 'https://www.sim.ai',
})

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simstudio-ts-sdk",
"version": "0.2.0",
"version": "0.2.1",
"description": "Sim SDK - Execute workflows programmatically",
"type": "module",
"exports": {
Expand Down
4 changes: 2 additions & 2 deletions packages/ts-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface SimStudioConfig {
* rather than read at runtime, so the SDK stays usable where there is no file
* system to read it from.
*/
export const SDK_VERSION = '0.2.0'
export const SDK_VERSION = '0.2.1'

/**
* Identifies this SDK to the API on every request, the way every official Sim
Expand Down Expand Up @@ -216,7 +216,7 @@ export class SimStudioClient {

constructor(config: SimStudioConfig) {
this.apiKey = config.apiKey
this.baseUrl = normalizeBaseUrl(config.baseUrl || 'https://sim.ai')
this.baseUrl = normalizeBaseUrl(config.baseUrl || 'https://www.sim.ai')
Comment thread
waleedlatif1 marked this conversation as resolved.
}

/** The headers every request carries: the credential and the client's identity. */
Expand Down
Loading