Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
158 changes: 79 additions & 79 deletions agentplatform/_genai/feedback_contexts.py

Large diffs are not rendered by default.

340 changes: 170 additions & 170 deletions agentplatform/_genai/feedback_entries.py

Large diffs are not rendered by default.

184 changes: 98 additions & 86 deletions agentplatform/_genai/types/__init__.py

Large diffs are not rendered by default.

331 changes: 184 additions & 147 deletions agentplatform/_genai/types/common.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def test_create(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

assert operation.response is not None
Expand Down Expand Up @@ -86,15 +86,15 @@ async def test_create_async(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

assert operation.response is not None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_delete(client):
)
assert isinstance(
delete_operation,
types.DeleteAgentEngineFeedbackEntryOperation,
types.DeleteRuntimeFeedbackEntryOperation,
)
assert delete_operation.done

Expand Down Expand Up @@ -85,7 +85,7 @@ async def test_delete_async(client):
)
assert isinstance(
delete_operation,
types.DeleteAgentEngineFeedbackEntryOperation,
types.DeleteRuntimeFeedbackEntryOperation,
)

with pytest.raises(errors.ClientError, match="404 NOT_FOUND"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def test_get(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

feedback = client.feedback_entries.get(name=operation.response.name)
Expand Down Expand Up @@ -81,15 +81,15 @@ async def test_get_async(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

feedback = await client.aio.feedback_entries.get(name=operation.response.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def test_list(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation_up, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation_up, types.RuntimeFeedbackEntryOperation)
assert operation_up.done

# Create THUMBS_DOWN feedback entry.
Expand All @@ -60,15 +60,15 @@ def test_list(client):
session_id="session_abc",
event_id="event_xyz",
feedback_type=types.FeedbackType.THUMBS_DOWN,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Response was incorrect.",
feedback_labels=["off_topic", "hallucination"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key_a": "val_a"},
),
)
assert isinstance(operation_down, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation_down, types.RuntimeFeedbackEntryOperation)
assert operation_down.done

# List and verify the feedback entries.
Expand Down Expand Up @@ -123,15 +123,15 @@ async def test_list_async(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete", "inaccurate"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation_up, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation_up, types.RuntimeFeedbackEntryOperation)
assert operation_up.done

# Create THUMBS_DOWN feedback entry.
Expand All @@ -140,15 +140,15 @@ async def test_list_async(client):
session_id="session_abc",
event_id="event_xyz",
feedback_type=types.FeedbackType.THUMBS_DOWN,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Response was incorrect.",
feedback_labels=["off_topic", "hallucination"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key_a": "val_a"},
),
)
assert isinstance(operation_down, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation_down, types.RuntimeFeedbackEntryOperation)
assert operation_down.done

# List and verify the feedback entries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_update_and_get(client):
],
)

assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_update_and_get(client):
),
],
)
assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand All @@ -102,7 +102,7 @@ def test_update_and_get(client):
parent=feedback_entry.name,
context_events=[],
)
assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand Down Expand Up @@ -141,7 +141,7 @@ async def test_update_and_get_async(client):
],
)

assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand Down Expand Up @@ -176,7 +176,7 @@ async def test_update_and_get_async(client):
),
],
)
assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand All @@ -187,7 +187,7 @@ async def test_update_and_get_async(client):
parent=feedback_entry.name,
context_events=[],
)
assert isinstance(update_operation, types.AgentEngineFeedbackContextOperation)
assert isinstance(update_operation, types.RuntimeFeedbackContextOperation)
assert update_operation.done

updated_context = update_operation.response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def test_update(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

assert operation.response is not None
Expand All @@ -60,7 +60,7 @@ def test_update(client):

update_operation = client.feedback_entries.update(
name=feedback_entry.name,
config=types.UpdateAgentEngineFeedbackEntryConfig(
config=types.UpdateRuntimeFeedbackEntryConfig(
update_mask="feedbackType,feedbackText,feedbackLabels,userId,source,customMetadata",
feedback_type=types.FeedbackType.THUMBS_DOWN,
feedback_text="Actually bad response!",
Expand All @@ -71,7 +71,7 @@ def test_update(client):
),
)

assert isinstance(update_operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(update_operation, types.RuntimeFeedbackEntryOperation)
assert update_operation.done

updated_feedback = update_operation.response
Expand All @@ -89,16 +89,14 @@ def test_update(client):
# Second update: change only session_id and event_id via a scoped mask.
session_update_operation = client.feedback_entries.update(
name=feedback_entry.name,
config=types.UpdateAgentEngineFeedbackEntryConfig(
config=types.UpdateRuntimeFeedbackEntryConfig(
update_mask="sessionId,eventId",
session_id="session_new_456",
event_id="event_new_789",
),
)

assert isinstance(
session_update_operation, types.AgentEngineFeedbackEntryOperation
)
assert isinstance(session_update_operation, types.RuntimeFeedbackEntryOperation)
assert session_update_operation.done

session_updated_feedback = session_update_operation.response
Expand Down Expand Up @@ -133,15 +131,15 @@ async def test_update_async(client):
session_id="session_123",
event_id="event_456",
feedback_type=types.FeedbackType.THUMBS_UP,
config=types.CreateAgentEngineFeedbackEntryConfig(
config=types.CreateRuntimeFeedbackEntryConfig(
feedback_text="Great response!",
feedback_labels=["incomplete"],
user_id="user_789",
source="Test IDE",
custom_metadata={"key1": "val1", "key2": "val2"},
),
)
assert isinstance(operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(operation, types.RuntimeFeedbackEntryOperation)
assert operation.done

assert operation.response is not None
Expand All @@ -151,7 +149,7 @@ async def test_update_async(client):

update_operation = await client.aio.feedback_entries.update(
name=feedback_entry.name,
config=types.UpdateAgentEngineFeedbackEntryConfig(
config=types.UpdateRuntimeFeedbackEntryConfig(
update_mask="feedbackType,feedbackText,feedbackLabels,userId,source,customMetadata",
feedback_type=types.FeedbackType.THUMBS_DOWN,
feedback_text="Actually bad response!",
Expand All @@ -162,7 +160,7 @@ async def test_update_async(client):
),
)

assert isinstance(update_operation, types.AgentEngineFeedbackEntryOperation)
assert isinstance(update_operation, types.RuntimeFeedbackEntryOperation)
assert update_operation.done

updated_feedback = update_operation.response
Expand All @@ -180,16 +178,14 @@ async def test_update_async(client):
# Second update: change only session_id and event_id via a scoped mask.
session_update_operation = await client.aio.feedback_entries.update(
name=feedback_entry.name,
config=types.UpdateAgentEngineFeedbackEntryConfig(
config=types.UpdateRuntimeFeedbackEntryConfig(
update_mask="sessionId,eventId",
session_id="session_new_456",
event_id="event_new_789",
),
)

assert isinstance(
session_update_operation, types.AgentEngineFeedbackEntryOperation
)
assert isinstance(session_update_operation, types.RuntimeFeedbackEntryOperation)
assert session_update_operation.done

session_updated_feedback = session_update_operation.response
Expand Down
Loading