simile 0.2.3__tar.gz → 0.2.5__tar.gz

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.

Potentially problematic release.


This version of simile might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simile
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Package for interfacing with Simile AI agents for simulation
5
5
  Author-email: Simile AI <cqz@simile.ai>
6
6
  License: MIT
@@ -21,6 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: httpx>=0.20.0
23
23
  Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: genagent>=0.2.3
24
25
  Dynamic: license-file
25
26
 
26
27
  # Simile API Python Client
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "simile"
7
- version = "0.2.3"
7
+ version = "0.2.5"
8
8
  authors = [
9
9
  { name="Simile AI", email="cqz@simile.ai" },
10
10
  ]
@@ -29,6 +29,7 @@ classifiers = [
29
29
  dependencies = [
30
30
  "httpx>=0.20.0",
31
31
  "pydantic>=2.0.0",
32
+ "genagent>=0.2.3",
32
33
  ]
33
34
 
34
35
  [project.urls]
@@ -64,8 +64,22 @@ class Simile:
64
64
  raise SimileBadRequestError(detail=detail)
65
65
  else:
66
66
  raise SimileAPIError(f"API request failed: {e}", status_code=status_code, detail=detail)
67
+ except httpx.ConnectTimeout:
68
+ raise SimileAPIError("Connection timed out while trying to connect.")
69
+ except httpx.ReadTimeout:
70
+ raise SimileAPIError("Timed out waiting for data from the server.")
71
+ except httpx.WriteTimeout:
72
+ raise SimileAPIError("Timed out while sending data to the server.")
73
+ except httpx.PoolTimeout:
74
+ raise SimileAPIError("Timed out waiting for a connection from the pool.")
75
+ except httpx.ConnectError:
76
+ raise SimileAPIError("Failed to connect to the server.")
77
+ except httpx.ProtocolError:
78
+ raise SimileAPIError("A protocol error occurred.")
79
+ except httpx.DecodingError:
80
+ raise SimileAPIError("Failed to decode the response.")
67
81
  except httpx.RequestError as e:
68
- raise SimileAPIError(f"Request error: {e}")
82
+ raise SimileAPIError(f"An unknown request error occurred: {type(e).__name__}: {e}")
69
83
 
70
84
  def agent(self, agent_id: uuid.UUID) -> Agent:
71
85
  """Returns an Agent object to interact with a specific agent."""
@@ -105,7 +119,7 @@ class Simile:
105
119
  """Retrieves all agents belonging to a specific population."""
106
120
  endpoint = f"populations/{str(population_id)}/agents"
107
121
  raw_response = await self._request("GET", endpoint)
108
- agents_data_list = raw_response.model_dump_json()
122
+ agents_data_list = raw_response.json()
109
123
  return [AgentModel(**data) for data in agents_data_list]
110
124
 
111
125
  async def create_agent(self, name: str, population_id: Optional[Union[str, uuid.UUID]] = None, agent_data: Optional[List[Dict[str, Any]]] = None) -> AgentModel:
@@ -142,7 +156,7 @@ class Simile:
142
156
  params["data_type"] = data_type
143
157
  agent_id_str = str(agent_id)
144
158
  raw_response = await self._request("GET", f"data_item/list/{agent_id_str}", params=params)
145
- return [DataItem(**item) for item in raw_response.model_dump_json()]
159
+ return [DataItem(**item) for item in raw_response.json()]
146
160
 
147
161
  async def update_data_item(self, data_item_id: Union[str, uuid.UUID], content: Any) -> DataItem:
148
162
  """Updates an existing data item."""
@@ -154,10 +168,10 @@ class Simile:
154
168
  response_data = await self._request("DELETE", f"data_item/delete/{str(data_item_id)}", response_model=DeletionResponse)
155
169
  return response_data
156
170
 
157
- async def generate_qual_response(self, agent_id: uuid.UUID, question: str) -> QualGenerationResponse:
171
+ async def generate_qual_response(self, agent_id: uuid.UUID, question: str, image_url: Optional[str] = None) -> QualGenerationResponse:
158
172
  """Generates a qualitative response from an agent based on a question."""
159
173
  endpoint = f"/generation/qual/{str(agent_id)}"
160
- request_payload = QualGenerationRequest(question=question)
174
+ request_payload = QualGenerationRequest(question=question, image_url=image_url)
161
175
  response_data = await self._request(
162
176
  "POST",
163
177
  endpoint,
@@ -166,10 +180,10 @@ class Simile:
166
180
  )
167
181
  return response_data
168
182
 
169
- async def generate_mc_response(self, agent_id: uuid.UUID, question: str, options: List[str]) -> MCGenerationResponse:
183
+ async def generate_mc_response(self, agent_id: uuid.UUID, question: str, options: List[str], image_url: Optional[str] = None) -> MCGenerationResponse:
170
184
  """Generates a multiple-choice response from an agent."""
171
185
  endpoint = f"generation/mc/{str(agent_id)}"
172
- request_payload = MCGenerationRequest(question=question, options=options)
186
+ request_payload = MCGenerationRequest(question=question, options=options, image_url=image_url)
173
187
  response_data = await self._request(
174
188
  "POST",
175
189
  endpoint,
@@ -61,6 +61,7 @@ class DeletionResponse(BaseModel):
61
61
  # --- Generation Operation Models ---
62
62
  class QualGenerationRequest(BaseModel):
63
63
  question: str
64
+ image_url: Optional[str] = None
64
65
 
65
66
  class QualGenerationResponse(BaseModel):
66
67
  question: str
@@ -69,6 +70,7 @@ class QualGenerationResponse(BaseModel):
69
70
  class MCGenerationRequest(BaseModel):
70
71
  question: str
71
72
  options: List[str]
73
+ image_url: Optional[str] = None
72
74
 
73
75
  class MCGenerationResponse(BaseModel):
74
76
  question: str
@@ -1,5 +1,5 @@
1
1
  import uuid
2
- from typing import TYPE_CHECKING, List
2
+ from typing import TYPE_CHECKING, List, Optional
3
3
 
4
4
  from .models import (
5
5
  QualGenerationRequest,
@@ -22,13 +22,13 @@ class Agent:
22
22
  def id(self) -> uuid.UUID:
23
23
  return self._agent_id
24
24
 
25
- async def generate_qual_response(self, question: str) -> QualGenerationResponse:
25
+ async def generate_qual_response(self, question: str, image_url: Optional[str] = None) -> QualGenerationResponse:
26
26
  """Generates a qualitative response from this agent based on a question."""
27
- return await self._client.generate_qual_response(agent_id=self._agent_id, question=question)
27
+ return await self._client.generate_qual_response(agent_id=self._agent_id, question=question, image_url=image_url)
28
28
 
29
- async def generate_mc_response(self, question: str, options: List[str]) -> MCGenerationResponse:
29
+ async def generate_mc_response(self, question: str, options: List[str], image_url: Optional[str] = None) -> MCGenerationResponse:
30
30
  """Generates a multiple-choice response from this agent."""
31
- return await self._client.generate_mc_response(agent_id=self._agent_id, question=question, options=options)
31
+ return await self._client.generate_mc_response(agent_id=self._agent_id, question=question, options=options, image_url=image_url)
32
32
 
33
33
 
34
34
  class SurveySession:
@@ -51,10 +51,10 @@ class SurveySession:
51
51
  def status(self) -> str:
52
52
  return self._status
53
53
 
54
- async def generate_qual_response(self, question: str) -> QualGenerationResponse:
54
+ async def generate_qual_response(self, question: str, image_url: Optional[str] = None) -> QualGenerationResponse:
55
55
  """Generates a qualitative response within this survey session."""
56
56
  endpoint = f"sessions/{str(self._id)}/qual"
57
- payload = QualGenerationRequest(question=question)
57
+ payload = QualGenerationRequest(question=question, image_url=image_url)
58
58
  return await self._client._request(
59
59
  "POST",
60
60
  endpoint,
@@ -62,10 +62,10 @@ class SurveySession:
62
62
  response_model=QualGenerationResponse
63
63
  )
64
64
 
65
- async def generate_mc_response(self, question: str, options: List[str]) -> MCGenerationResponse:
65
+ async def generate_mc_response(self, question: str, options: List[str], image_url: Optional[str] = None) -> MCGenerationResponse:
66
66
  """Generates a multiple-choice response within this survey session."""
67
67
  endpoint = f"sessions/{str(self._id)}/mc"
68
- payload = MCGenerationRequest(question=question, options=options)
68
+ payload = MCGenerationRequest(question=question, options=options, image_url=image_url)
69
69
  return await self._client._request(
70
70
  "POST",
71
71
  endpoint,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simile
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Package for interfacing with Simile AI agents for simulation
5
5
  Author-email: Simile AI <cqz@simile.ai>
6
6
  License: MIT
@@ -21,6 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: httpx>=0.20.0
23
23
  Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: genagent>=0.2.3
24
25
  Dynamic: license-file
25
26
 
26
27
  # Simile API Python Client
@@ -1,2 +1,3 @@
1
1
  httpx>=0.20.0
2
2
  pydantic>=2.0.0
3
+ genagent>=0.2.3
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes