We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8e8262 commit a4a1a8aCopy full SHA for a4a1a8a
src/a2a/utils/task.py
@@ -29,16 +29,10 @@ def new_task(request: Message) -> Task:
29
raise ValueError('TextPart content cannot be empty')
30
31
context_id_str = request.context_id
32
- if context_id_str is not None:
33
- try:
34
- uuid.UUID(context_id_str)
35
- context_id = context_id_str
36
- except (ValueError, AttributeError, TypeError) as e:
37
- raise ValueError(
38
- f"Invalid context_id: '{context_id_str}' is not a valid UUID."
39
- ) from e
40
- else:
+ if not context_id_str:
41
context_id = str(uuid.uuid4())
+ else:
+ context_id = context_id_str
42
43
return Task(
44
status=TaskStatus(state=TaskState.submitted),
0 commit comments