amigo_sdk 0.8.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of amigo_sdk might be problematic. Click here for more details.

Files changed (53) hide show
  1. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/.github/workflows/auto-release.yml +36 -4
  2. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/PKG-INFO +35 -47
  3. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/README.md +34 -46
  4. amigo_sdk-0.9.0/openapi-new.json +1 -0
  5. amigo_sdk-0.9.0/specs/openapi-baseline.json +1 -0
  6. amigo_sdk-0.9.0/src/amigo_sdk/__init__.py +8 -0
  7. amigo_sdk-0.9.0/src/amigo_sdk/_retry_utils.py +70 -0
  8. amigo_sdk-0.9.0/src/amigo_sdk/auth.py +48 -0
  9. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/generated/model.py +2 -6
  10. amigo_sdk-0.9.0/src/amigo_sdk/http_client.py +379 -0
  11. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/conversation.py +156 -4
  12. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/organization.py +15 -3
  13. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/service.py +21 -5
  14. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/resources/user.py +43 -3
  15. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/sdk_client.py +100 -18
  16. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/integration/test_conversation_integration.py +153 -10
  17. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/integration/test_organization_integration.py +83 -31
  18. amigo_sdk-0.9.0/tests/integration/test_user_integration.py +181 -0
  19. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/resources/helpers.py +154 -4
  20. amigo_sdk-0.9.0/tests/resources/test_conversation.py +882 -0
  21. amigo_sdk-0.9.0/tests/resources/test_organization.py +95 -0
  22. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/resources/test_service.py +37 -5
  23. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/resources/test_user.py +95 -5
  24. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/test_auth.py +70 -5
  25. amigo_sdk-0.9.0/tests/test_http_client.py +741 -0
  26. amigo_sdk-0.9.0/tests/test_retry_utils.py +86 -0
  27. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/test_sdk_client.py +59 -8
  28. amigo_sdk-0.8.0/openapi-new.json +0 -1
  29. amigo_sdk-0.8.0/specs/openapi-baseline.json +0 -1
  30. amigo_sdk-0.8.0/src/amigo_sdk/__init__.py +0 -1
  31. amigo_sdk-0.8.0/src/amigo_sdk/auth.py +0 -30
  32. amigo_sdk-0.8.0/src/amigo_sdk/http_client.py +0 -228
  33. amigo_sdk-0.8.0/tests/integration/test_user_integration.py +0 -97
  34. amigo_sdk-0.8.0/tests/resources/test_conversation.py +0 -463
  35. amigo_sdk-0.8.0/tests/resources/test_organization.py +0 -60
  36. amigo_sdk-0.8.0/tests/test_http_client.py +0 -551
  37. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/.github/workflows/release.yml +0 -0
  38. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/.github/workflows/test.yml +0 -0
  39. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/.gitignore +0 -0
  40. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/CONTRIBUTING.md +0 -0
  41. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/LICENSE +0 -0
  42. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/pyproject.toml +0 -0
  43. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/scripts/__init__.py +0 -0
  44. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/scripts/aliases.json +0 -0
  45. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/scripts/check.py +0 -0
  46. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/scripts/gen_models.py +0 -0
  47. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/config.py +0 -0
  48. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/src/amigo_sdk/errors.py +0 -0
  49. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/__init__.py +0 -0
  50. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/conftest.py +0 -0
  51. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/resources/__init__.py +0 -0
  52. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/test_config.py +0 -0
  53. {amigo_sdk-0.8.0 → amigo_sdk-0.9.0}/tests/test_errors.py +0 -0
@@ -54,8 +54,24 @@ jobs:
54
54
  echo "Resolved spec_url: ${{ steps.spec.outputs.spec_url }}"
55
55
  echo "Baseline missing: ${{ steps.baseline.outputs.missing }}"
56
56
  echo "jq version: $(jq --version)"
57
- jq -S 'del(.info.version) | del(.servers)' specs/openapi-baseline.json > baseline.norm.json || true
58
- jq -S 'del(.info.version) | del(.servers)' openapi-new.json > new.norm.json
57
+ jq -S '
58
+ def sort_deep:
59
+ if type == "array" then
60
+ map(sort_deep) | sort_by(tostring)
61
+ elif type == "object" then
62
+ with_entries(.value |= sort_deep)
63
+ else . end;
64
+ (del(.info) | del(.servers)) | sort_deep
65
+ ' specs/openapi-baseline.json > baseline.norm.json || true
66
+ jq -S '
67
+ def sort_deep:
68
+ if type == "array" then
69
+ map(sort_deep) | sort_by(tostring)
70
+ elif type == "object" then
71
+ with_entries(.value |= sort_deep)
72
+ else . end;
73
+ (del(.info) | del(.servers)) | sort_deep
74
+ ' openapi-new.json > new.norm.json
59
75
  if [ -f baseline.norm.json ]; then
60
76
  echo "BASELINE_NORM_SHA=$(sha256sum baseline.norm.json | awk '{print $1}')"
61
77
  else
@@ -119,8 +135,24 @@ jobs:
119
135
  echo "changed=true" >> $GITHUB_OUTPUT
120
136
  exit 0
121
137
  fi
122
- jq -S 'del(.info.version) | del(.servers)' specs/openapi-baseline.json > baseline.norm.json
123
- jq -S 'del(.info.version) | del(.servers)' openapi-new.json > new.norm.json
138
+ jq -S '
139
+ def sort_deep:
140
+ if type == "array" then
141
+ map(sort_deep) | sort_by(tostring)
142
+ elif type == "object" then
143
+ with_entries(.value |= sort_deep)
144
+ else . end;
145
+ (del(.info) | del(.servers)) | sort_deep
146
+ ' specs/openapi-baseline.json > baseline.norm.json
147
+ jq -S '
148
+ def sort_deep:
149
+ if type == "array" then
150
+ map(sort_deep) | sort_by(tostring)
151
+ elif type == "object" then
152
+ with_entries(.value |= sort_deep)
153
+ else . end;
154
+ (del(.info) | del(.servers)) | sort_deep
155
+ ' openapi-new.json > new.norm.json
124
156
  if diff -q baseline.norm.json new.norm.json >/dev/null 2>&1; then
125
157
  echo "changed=false" >> $GITHUB_OUTPUT
126
158
  else
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: amigo_sdk
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Amigo AI Python SDK
5
5
  Author: Amigo AI
6
6
  License-File: LICENSE
@@ -46,34 +46,23 @@ amigo_sdk
46
46
 
47
47
  This SDK auto-generates its types from the latest [Amigo OpenAPI schema](https://api.amigo.ai/v1/openapi.json). As a result, only the latest published SDK version is guaranteed to match the current API. If you pin to an older version, it may not include the newest endpoints or fields.
48
48
 
49
- ## Quick Start
49
+ ## Quick Start (sync)
50
50
 
51
51
  ```python
52
- import asyncio
53
52
  from amigo_sdk import AmigoClient
54
53
  from amigo_sdk.generated.model import GetConversationsParametersQuery
55
54
 
56
- # Initialize the client
57
- client = AmigoClient(
55
+ # Initialize and use the client synchronously
56
+ with AmigoClient(
58
57
  api_key="your-api-key",
59
58
  api_key_id="your-api-key-id",
60
59
  user_id="user-id",
61
- org_id="your-organization-id",
62
- )
63
-
64
- # List recent conversations
65
- async def example():
66
- try:
67
- async with client:
68
- conversations = await client.conversation.get_conversations(
69
- GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
70
- )
71
- print("Conversations:", conversations)
72
- except Exception as error:
73
- print(error)
74
-
75
- # Run the example
76
- asyncio.run(example())
60
+ organization_id="your-organization-id",
61
+ ) as client:
62
+ conversations = client.conversation.get_conversations(
63
+ GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
64
+ )
65
+ print("Conversations:", conversations)
77
66
  ```
78
67
 
79
68
  ## Examples
@@ -84,13 +73,13 @@ For more SDK usage examples see checkout the [examples/](examples/README.md) fol
84
73
 
85
74
  The SDK requires the following configuration parameters:
86
75
 
87
- | Parameter | Type | Required | Description |
88
- | ------------ | ---- | -------- | -------------------------------------------------------------- |
89
- | `api_key` | str | ✅ | API key from Amigo dashboard |
90
- | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
91
- | `user_id` | str | ✅ | User ID on whose behalf the request is made |
92
- | `org_id` | str | ✅ | Your organization ID |
93
- | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
76
+ | Parameter | Type | Required | Description |
77
+ | ----------------- | ---- | -------- | -------------------------------------------------------------- |
78
+ | `api_key` | str | ✅ | API key from Amigo dashboard |
79
+ | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
80
+ | `user_id` | str | ✅ | User ID on whose behalf the request is made |
81
+ | `organization_id` | str | ✅ | Your organization ID |
82
+ | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
94
83
 
95
84
  ### Environment Variables
96
85
 
@@ -100,7 +89,7 @@ You can also configure the SDK using environment variables:
100
89
  export AMIGO_API_KEY="your-api-key"
101
90
  export AMIGO_API_KEY_ID="your-api-key-id"
102
91
  export AMIGO_USER_ID="user-id"
103
- export AMIGO_ORG_ID="your-organization-id"
92
+ export AMIGO_ORGANIZATION_ID="your-organization-id"
104
93
  export AMIGO_BASE_URL="https://api.amigo.ai" # optional
105
94
  ```
106
95
 
@@ -110,7 +99,8 @@ Then initialize the client without parameters:
110
99
  from amigo_sdk import AmigoClient
111
100
 
112
101
  # Automatically loads from environment variables
113
- client = AmigoClient()
102
+ with AmigoClient() as client:
103
+ ...
114
104
  ```
115
105
 
116
106
  ### Using .env Files
@@ -153,25 +143,23 @@ from amigo_sdk.errors import (
153
143
  AuthenticationError,
154
144
  NotFoundError,
155
145
  BadRequestError,
156
- ValidationError
146
+ ValidationError,
157
147
  )
158
148
 
159
- async def example_with_error_handling():
160
- client = AmigoClient()
161
-
162
- try:
163
- async with client:
164
- result = await client.organizations.get_organization("org-id")
165
- except AuthenticationError as error:
166
- print("Authentication failed:", error)
167
- except NotFoundError as error:
168
- print("Resource not found:", error)
169
- except BadRequestError as error:
170
- print("Bad request:", error)
171
- except ValidationError as error:
172
- print("Validation error:", error)
173
- except Exception as error:
174
- print("Unexpected error:", error)
149
+ try:
150
+ with AmigoClient() as client:
151
+ org = client.organization.get()
152
+ print("Organization:", org)
153
+ except AuthenticationError as error:
154
+ print("Authentication failed:", error)
155
+ except NotFoundError as error:
156
+ print("Resource not found:", error)
157
+ except BadRequestError as error:
158
+ print("Bad request:", error)
159
+ except ValidationError as error:
160
+ print("Validation error:", error)
161
+ except Exception as error:
162
+ print("Unexpected error:", error)
175
163
  ```
176
164
 
177
165
  ## Development
@@ -24,34 +24,23 @@ amigo_sdk
24
24
 
25
25
  This SDK auto-generates its types from the latest [Amigo OpenAPI schema](https://api.amigo.ai/v1/openapi.json). As a result, only the latest published SDK version is guaranteed to match the current API. If you pin to an older version, it may not include the newest endpoints or fields.
26
26
 
27
- ## Quick Start
27
+ ## Quick Start (sync)
28
28
 
29
29
  ```python
30
- import asyncio
31
30
  from amigo_sdk import AmigoClient
32
31
  from amigo_sdk.generated.model import GetConversationsParametersQuery
33
32
 
34
- # Initialize the client
35
- client = AmigoClient(
33
+ # Initialize and use the client synchronously
34
+ with AmigoClient(
36
35
  api_key="your-api-key",
37
36
  api_key_id="your-api-key-id",
38
37
  user_id="user-id",
39
- org_id="your-organization-id",
40
- )
41
-
42
- # List recent conversations
43
- async def example():
44
- try:
45
- async with client:
46
- conversations = await client.conversation.get_conversations(
47
- GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
48
- )
49
- print("Conversations:", conversations)
50
- except Exception as error:
51
- print(error)
52
-
53
- # Run the example
54
- asyncio.run(example())
38
+ organization_id="your-organization-id",
39
+ ) as client:
40
+ conversations = client.conversation.get_conversations(
41
+ GetConversationsParametersQuery(limit=10, sort_by=["-created_at"])
42
+ )
43
+ print("Conversations:", conversations)
55
44
  ```
56
45
 
57
46
  ## Examples
@@ -62,13 +51,13 @@ For more SDK usage examples see checkout the [examples/](examples/README.md) fol
62
51
 
63
52
  The SDK requires the following configuration parameters:
64
53
 
65
- | Parameter | Type | Required | Description |
66
- | ------------ | ---- | -------- | -------------------------------------------------------------- |
67
- | `api_key` | str | ✅ | API key from Amigo dashboard |
68
- | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
69
- | `user_id` | str | ✅ | User ID on whose behalf the request is made |
70
- | `org_id` | str | ✅ | Your organization ID |
71
- | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
54
+ | Parameter | Type | Required | Description |
55
+ | ----------------- | ---- | -------- | -------------------------------------------------------------- |
56
+ | `api_key` | str | ✅ | API key from Amigo dashboard |
57
+ | `api_key_id` | str | ✅ | API key ID from Amigo dashboard |
58
+ | `user_id` | str | ✅ | User ID on whose behalf the request is made |
59
+ | `organization_id` | str | ✅ | Your organization ID |
60
+ | `base_url` | str | ❌ | Base URL of the Amigo API (defaults to `https://api.amigo.ai`) |
72
61
 
73
62
  ### Environment Variables
74
63
 
@@ -78,7 +67,7 @@ You can also configure the SDK using environment variables:
78
67
  export AMIGO_API_KEY="your-api-key"
79
68
  export AMIGO_API_KEY_ID="your-api-key-id"
80
69
  export AMIGO_USER_ID="user-id"
81
- export AMIGO_ORG_ID="your-organization-id"
70
+ export AMIGO_ORGANIZATION_ID="your-organization-id"
82
71
  export AMIGO_BASE_URL="https://api.amigo.ai" # optional
83
72
  ```
84
73
 
@@ -88,7 +77,8 @@ Then initialize the client without parameters:
88
77
  from amigo_sdk import AmigoClient
89
78
 
90
79
  # Automatically loads from environment variables
91
- client = AmigoClient()
80
+ with AmigoClient() as client:
81
+ ...
92
82
  ```
93
83
 
94
84
  ### Using .env Files
@@ -131,25 +121,23 @@ from amigo_sdk.errors import (
131
121
  AuthenticationError,
132
122
  NotFoundError,
133
123
  BadRequestError,
134
- ValidationError
124
+ ValidationError,
135
125
  )
136
126
 
137
- async def example_with_error_handling():
138
- client = AmigoClient()
139
-
140
- try:
141
- async with client:
142
- result = await client.organizations.get_organization("org-id")
143
- except AuthenticationError as error:
144
- print("Authentication failed:", error)
145
- except NotFoundError as error:
146
- print("Resource not found:", error)
147
- except BadRequestError as error:
148
- print("Bad request:", error)
149
- except ValidationError as error:
150
- print("Validation error:", error)
151
- except Exception as error:
152
- print("Unexpected error:", error)
127
+ try:
128
+ with AmigoClient() as client:
129
+ org = client.organization.get()
130
+ print("Organization:", org)
131
+ except AuthenticationError as error:
132
+ print("Authentication failed:", error)
133
+ except NotFoundError as error:
134
+ print("Resource not found:", error)
135
+ except BadRequestError as error:
136
+ print("Bad request:", error)
137
+ except ValidationError as error:
138
+ print("Validation error:", error)
139
+ except Exception as error:
140
+ print("Unexpected error:", error)
153
141
  ```
154
142
 
155
143
  ## Development