From b521a9cb7e5c8533952f87b0b673ea1858468ade Mon Sep 17 00:00:00 2001 From: Diwank Singh Tomer Date: Fri, 26 Apr 2024 14:31:46 +0530 Subject: [PATCH] fix: Session.user_id should be optional (#298) * fix: Session.user_id should be optional Signed-off-by: Diwank Singh Tomer * refactor: Lint sdks/ts (CI) --------- Signed-off-by: Diwank Singh Tomer Co-authored-by: creatorrr --- agents-api/agents_api/autogen/openapi_model.py | 4 ++-- agents-api/poetry.lock | 6 +++--- mock_openapi.yaml | 1 - openapi.yaml | 1 - sdks/python/julep/api/types/session.py | 2 +- sdks/python/pyproject.toml | 2 +- sdks/python/tests/test_sessions.py | 8 ++++++++ sdks/ts/package-lock.json | 4 ++-- sdks/ts/package.json | 15 ++++++++++++--- sdks/ts/src/api/models/Session.ts | 2 +- sdks/ts/src/api/schemas/$Session.ts | 1 - 11 files changed, 30 insertions(+), 16 deletions(-) diff --git a/agents-api/agents_api/autogen/openapi_model.py b/agents-api/agents_api/autogen/openapi_model.py index 900b8ccf8..fc3f995d4 100644 --- a/agents-api/agents_api/autogen/openapi_model.py +++ b/agents-api/agents_api/autogen/openapi_model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: openapi.yaml -# timestamp: 2024-04-20T14:32:07+00:00 +# timestamp: 2024-04-26T08:42:42+00:00 from __future__ import annotations @@ -92,7 +92,7 @@ class Session(BaseModel): """ Session id (UUID) """ - user_id: UUID + user_id: UUID | None = None """ User ID of user associated with this session """ diff --git a/agents-api/poetry.lock b/agents-api/poetry.lock index f29be1145..82609c100 100644 --- a/agents-api/poetry.lock +++ b/agents-api/poetry.lock @@ -1240,13 +1240,13 @@ referencing = ">=0.31.0" [[package]] name = "julep" -version = "0.2.13" +version = "0.2.14" description = "Julep is a platform for creating agents with long-term memory" optional = false python-versions = "<3.14,>=3.8" files = [ - {file = "julep-0.2.13-py3-none-any.whl", hash = "sha256:5a8aadfb31dc4caaab1dc0d098483eba8783042ac93461106f39a6a62f61146a"}, - {file = "julep-0.2.13.tar.gz", hash = "sha256:a2e3f7e19e350c72640df48644e8b4ef86bbf57f08e49a9650188aa876fa5b0e"}, + {file = "julep-0.2.14-py3-none-any.whl", hash = "sha256:bc3edab590b7942309e4c03ef3300689d58aa92fb362dc3642046f341ccebf75"}, + {file = "julep-0.2.14.tar.gz", hash = "sha256:504ab31ec6e015f9dac1c5dc0d86a7f56ab1dba0228f215191ff5b016f159c82"}, ] [package.dependencies] diff --git a/mock_openapi.yaml b/mock_openapi.yaml index 64206b500..c30365969 100644 --- a/mock_openapi.yaml +++ b/mock_openapi.yaml @@ -1285,7 +1285,6 @@ components: default: false required: - id - - user_id - agent_id CreateUserRequest: $schema: http://json-schema.org/draft-04/schema# diff --git a/openapi.yaml b/openapi.yaml index bc20315f6..2fd2a92f8 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1285,7 +1285,6 @@ components: default: false required: - id - - user_id - agent_id CreateUserRequest: $schema: http://json-schema.org/draft-04/schema# diff --git a/sdks/python/julep/api/types/session.py b/sdks/python/julep/api/types/session.py index 56b31b524..97c442cd5 100644 --- a/sdks/python/julep/api/types/session.py +++ b/sdks/python/julep/api/types/session.py @@ -14,7 +14,7 @@ class Session(pydantic.BaseModel): id: str = pydantic.Field(description="Session id (UUID)") - user_id: str = pydantic.Field( + user_id: typing.Optional[str] = pydantic.Field( description="User ID of user associated with this session" ) agent_id: str = pydantic.Field( diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index ea418a36a..b7206d0b7 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "julep" -version = "0.3.0" +version = "0.3.1" description = "Julep is a platform for creating agents with long-term memory" authors = ["Julep Developers "] license = "ISC" diff --git a/sdks/python/tests/test_sessions.py b/sdks/python/tests/test_sessions.py index d16535fde..a8774aa80 100644 --- a/sdks/python/tests/test_sessions.py +++ b/sdks/python/tests/test_sessions.py @@ -61,6 +61,14 @@ def _(client=client, session=test_session_no_user): assert session.id +@test("sessions: sessions.get no user") +def _(client=client, session=test_session_no_user): + response = client.sessions.get(id=session.id) + + assert isinstance(response, Session) + assert response.id == session.id + + @test("sessions: sessions.get") def _(client=client, session=test_session): response = client.sessions.get(id=session.id) diff --git a/sdks/ts/package-lock.json b/sdks/ts/package-lock.json index ef4967fcf..2cc1421f9 100644 --- a/sdks/ts/package-lock.json +++ b/sdks/ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@julep/sdk", - "version": "0.2.13", + "version": "0.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@julep/sdk", - "version": "0.2.13", + "version": "0.3.0", "license": "ISC", "dependencies": { "@rollup/plugin-typescript": "^11.1.6", diff --git a/sdks/ts/package.json b/sdks/ts/package.json index 84be57fd5..2f4b94555 100644 --- a/sdks/ts/package.json +++ b/sdks/ts/package.json @@ -1,8 +1,15 @@ { "name": "@julep/sdk", - "version": "0.3.0", + "version": "0.3.1", "description": "Julep is a platform for creating agents with long-term memory", - "keywords": ["julep-ai", "julep", "agents", "llms", "memory", "ai"], + "keywords": [ + "julep-ai", + "julep", + "agents", + "llms", + "memory", + "ai" + ], "author": { "name": "Julep", "email": "developers@julep.ai" @@ -75,5 +82,7 @@ "prepublishOnly": "npm run build", "test": "npm run format && npm run start_mock_api && sleep 1 && jest && npm run kill_mock_api" }, - "files": ["dist"] + "files": [ + "dist" + ] } diff --git a/sdks/ts/src/api/models/Session.ts b/sdks/ts/src/api/models/Session.ts index b944ba81b..2312a7a4b 100644 --- a/sdks/ts/src/api/models/Session.ts +++ b/sdks/ts/src/api/models/Session.ts @@ -10,7 +10,7 @@ export type Session = { /** * User ID of user associated with this session */ - user_id: string; + user_id?: string; /** * Agent ID of agent associated with this session */ diff --git a/sdks/ts/src/api/schemas/$Session.ts b/sdks/ts/src/api/schemas/$Session.ts index 1fb17d4d1..ccbbff296 100644 --- a/sdks/ts/src/api/schemas/$Session.ts +++ b/sdks/ts/src/api/schemas/$Session.ts @@ -13,7 +13,6 @@ export const $Session = { user_id: { type: "string", description: `User ID of user associated with this session`, - isRequired: true, format: "uuid", }, agent_id: {