gohumanloop 0.0.5__py3-none-any.whl → 0.0.6__py3-none-any.whl

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.
@@ -2,53 +2,78 @@ from typing import Dict, Any, Optional
2
2
 
3
3
  from pydantic import BaseModel, Field
4
4
 
5
+
5
6
  # Define the data models for requests and responses
6
7
  class APIResponse(BaseModel):
7
8
  """Base model for API responses"""
8
- success: bool = Field(default=False, description="Whether the request was successful")
9
+
10
+ success: bool = Field(
11
+ default=False, description="Whether the request was successful"
12
+ )
9
13
  error: Optional[str] = Field(default=None, description="Error message if any")
10
14
 
15
+
11
16
  class HumanLoopRequestData(BaseModel):
12
17
  """Model for human-in-the-loop request data"""
18
+
13
19
  task_id: str = Field(description="Task identifier")
14
20
  conversation_id: str = Field(description="Conversation identifier")
15
21
  request_id: str = Field(description="Request identifier")
16
22
  loop_type: str = Field(description="Type of loop")
17
- context: Dict[str, Any] = Field(description="Context information provided to humans")
23
+ context: Dict[str, Any] = Field(
24
+ description="Context information provided to humans"
25
+ )
18
26
  platform: str = Field(description="Platform being used, e.g. wechat, feishu")
19
- metadata: Dict[str, Any] = Field(default_factory=dict, description="Additional metadata")
27
+ metadata: Dict[str, Any] = Field(
28
+ default_factory=dict, description="Additional metadata"
29
+ )
30
+
20
31
 
21
32
  class HumanLoopStatusParams(BaseModel):
22
33
  """Model for getting human-in-the-loop status parameters"""
34
+
23
35
  conversation_id: str = Field(description="Conversation identifier")
24
36
  request_id: str = Field(description="Request identifier")
25
37
  platform: str = Field(description="Platform being used")
26
38
 
39
+
27
40
  class HumanLoopStatusResponse(APIResponse):
28
41
  """Model for human-in-the-loop status response"""
42
+
29
43
  status: str = Field(default="pending", description="Request status")
30
44
  response: Optional[Any] = Field(default=None, description="Human response data")
31
45
  feedback: Optional[Any] = Field(default=None, description="Feedback data")
32
- responded_by: Optional[str] = Field(default=None, description="Responder information")
46
+ responded_by: Optional[str] = Field(
47
+ default=None, description="Responder information"
48
+ )
33
49
  responded_at: Optional[str] = Field(default=None, description="Response timestamp")
34
50
 
51
+
35
52
  class HumanLoopCancelData(BaseModel):
36
53
  """Model for canceling human-in-the-loop request"""
54
+
37
55
  conversation_id: str = Field(description="Conversation identifier")
38
56
  request_id: str = Field(description="Request identifier")
39
57
  platform: str = Field(description="Platform being used")
40
58
 
59
+
41
60
  class HumanLoopCancelConversationData(BaseModel):
42
61
  """Model for canceling entire conversation"""
62
+
43
63
  conversation_id: str = Field(description="Conversation identifier")
44
64
  platform: str = Field(description="Platform being used")
45
65
 
66
+
46
67
  class HumanLoopContinueData(BaseModel):
47
68
  """Model for continuing human-in-the-loop interaction"""
69
+
48
70
  conversation_id: str = Field(description="Conversation identifier")
49
71
  request_id: str = Field(description="Request identifier")
50
72
  task_id: str = Field(description="Task identifier")
51
- context: Dict[str, Any] = Field(description="Context information provided to humans")
73
+ context: Dict[str, Any] = Field(
74
+ description="Context information provided to humans"
75
+ )
52
76
  platform: str = Field(description="Platform being used")
53
- metadata: Dict[str, Any] = Field(default_factory=dict, description="Additional metadata")
54
-
77
+ metadata: Dict[str, Any] = Field(
78
+ default_factory=dict, description="Additional metadata"
79
+ )
@@ -1,23 +1,27 @@
1
+ from typing import Any
1
2
  from pydantic import BaseModel, Field, field_validator, SecretStr
2
3
 
4
+
3
5
  class GoHumanLoopConfig(BaseModel):
4
6
  """GoHumanLoop Configuration Model"""
7
+
5
8
  api_key: SecretStr = Field(..., description="GoHumanLoop API Key")
6
9
  api_base_url: str = Field(
7
- default="https://www.gohumanloop.com",
8
- description="GoHumanLoop API Base URL"
10
+ default="https://www.gohumanloop.com", description="GoHumanLoop API Base URL"
9
11
  )
10
-
11
- @field_validator('api_key')
12
- def validate_api_key(cls, v):
12
+
13
+ @field_validator("api_key")
14
+ def validate_api_key(cls, v: SecretStr) -> Any:
13
15
  """Validate that API Key is not empty"""
14
16
  if not v:
15
17
  raise ValueError("GoHumanLoop API Key cannot be None or empty")
16
18
  return v
17
-
18
- @field_validator('api_base_url')
19
- def validate_api_base_url(cls, v):
19
+
20
+ @field_validator("api_base_url")
21
+ def validate_api_base_url(cls, v: str) -> Any:
20
22
  """Validate API Base URL"""
21
- if not v.startswith(('http://', 'https://')):
22
- raise ValueError("GoHumanLoop API Base URL must start with http:// or https://")
23
- return v.rstrip('/')
23
+ if not v.startswith(("http://", "https://")):
24
+ raise ValueError(
25
+ "GoHumanLoop API Base URL must start with http:// or https://"
26
+ )
27
+ return v.rstrip("/")