Skip to content

Commit b3a2b51

Browse files
mostafaalaa3glasnt
andauthored
feat: Update session sample with the new SessionServiceClient (#13529)
* feat: Update session sample with the new SessionServiceClient instead of ConversationalSearchServiceClient * chore(deps): update google-cloud-discoveryengine to new version supporting SessionService --------- Co-authored-by: Katie McLaughlin <[email protected]>
1 parent 8a89615 commit b3a2b51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

discoveryengine/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-discoveryengine==0.13.8
1+
google-cloud-discoveryengine==0.13.11

discoveryengine/session_sample.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create_session(
3737
discoveryengine.Session: The newly created Session.
3838
"""
3939

40-
client = discoveryengine.ConversationalSearchServiceClient()
40+
client = discoveryengine.SessionServiceClient()
4141

4242
session = client.create_session(
4343
# The full resource name of the engine
@@ -71,7 +71,7 @@ def get_session(
7171
session_id: The ID of the session.
7272
"""
7373

74-
client = discoveryengine.ConversationalSearchServiceClient()
74+
client = discoveryengine.SessionServiceClient()
7575

7676
# The full resource name of the session
7777
name = f"projects/{project_id}/locations/{location}/collections/default_collection/engines/{engine_id}/sessions/{session_id}"
@@ -104,7 +104,7 @@ def delete_session(
104104
session_id: The ID of the session.
105105
"""
106106

107-
client = discoveryengine.ConversationalSearchServiceClient()
107+
client = discoveryengine.SessionServiceClient()
108108

109109
# The full resource name of the session
110110
name = f"projects/{project_id}/locations/{location}/collections/default_collection/engines/{engine_id}/sessions/{session_id}"
@@ -138,7 +138,7 @@ def update_session(
138138
Returns:
139139
discoveryengine.Session: The updated Session.
140140
"""
141-
client = discoveryengine.ConversationalSearchServiceClient()
141+
client = discoveryengine.SessionServiceClient()
142142

143143
# The full resource name of the session
144144
name = f"projects/{project_id}/locations/{location}/collections/default_collection/engines/{engine_id}/sessions/{session_id}"
@@ -178,7 +178,7 @@ def list_sessions(
178178
discoveryengine.ListSessionsResponse: The list of sessions.
179179
"""
180180

181-
client = discoveryengine.ConversationalSearchServiceClient()
181+
client = discoveryengine.SessionServiceClient()
182182

183183
# The full resource name of the engine
184184
parent = f"projects/{project_id}/locations/{location}/collections/default_collection/engines/{engine_id}"

0 commit comments

Comments
 (0)