simile 0.4.1__py3-none-any.whl → 0.4.2__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.

Potentially problematic release.


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

simile/client.py CHANGED
@@ -431,15 +431,6 @@ class Simile:
431
431
  exclude_memory_ids: Study/question IDs to exclude from loaded memory
432
432
  save_memory: Session ID to automatically save response to memory
433
433
  """
434
- # If use_memory is provided and no explicit memory_stream, load it
435
- if use_memory and not memory_stream:
436
- memory_stream = await self.get_memory(
437
- session_id=use_memory,
438
- agent_id=agent_id,
439
- exclude_study_ids=exclude_memory_ids,
440
- use_memory=True
441
- )
442
-
443
434
  endpoint = f"/generation/open/{str(agent_id)}"
444
435
  # Build request payload directly as dict to avoid serialization issues
445
436
  request_payload = {
@@ -450,6 +441,16 @@ class Simile:
450
441
  "reasoning": reasoning,
451
442
  }
452
443
 
444
+ # Pass memory parameters to API for server-side handling
445
+ if use_memory:
446
+ request_payload["use_memory"] = str(use_memory)
447
+ if exclude_memory_ids:
448
+ request_payload["exclude_memory_ids"] = exclude_memory_ids
449
+
450
+ if save_memory:
451
+ request_payload["save_memory"] = str(save_memory)
452
+
453
+ # Only include explicit memory_stream if provided directly
453
454
  if memory_stream:
454
455
  request_payload["memory_stream"] = memory_stream.to_dict()
455
456
 
@@ -460,26 +461,8 @@ class Simile:
460
461
  response_model=OpenGenerationResponse,
461
462
  )
462
463
 
463
- # If save_memory is provided, save the response
464
- if save_memory and response_data:
465
- from .models import OpenQuestionMemoryTurn
466
-
467
- memory_turn = OpenQuestionMemoryTurn(
468
- user_question=question,
469
- user_images=images,
470
- llm_response=response_data.answer,
471
- llm_reasoning=response_data.reasoning if reasoning else None
472
- )
473
-
474
- await self.save_memory(
475
- agent_id=agent_id,
476
- response=response_data.answer,
477
- session_id=save_memory,
478
- memory_turn=memory_turn.to_dict(),
479
- memory_stream_used=memory_stream.to_dict() if memory_stream else None,
480
- reasoning=response_data.reasoning if reasoning else None,
481
- metadata={"question_type": "open"}
482
- )
464
+ # Don't save memory here - API should handle it when save_memory is passed
465
+ # Memory saving is now handled server-side for better performance
483
466
 
484
467
  return response_data
485
468
 
@@ -512,15 +495,6 @@ class Simile:
512
495
  exclude_memory_ids: Study/question IDs to exclude from loaded memory
513
496
  save_memory: Session ID to automatically save response to memory
514
497
  """
515
- # If use_memory is provided and no explicit memory_stream, load it
516
- if use_memory and not memory_stream:
517
- memory_stream = await self.get_memory(
518
- session_id=use_memory,
519
- agent_id=agent_id,
520
- exclude_study_ids=exclude_memory_ids,
521
- use_memory=True
522
- )
523
-
524
498
  endpoint = f"generation/closed/{str(agent_id)}"
525
499
  # Build request payload directly as dict to avoid serialization issues
526
500
  request_payload = {
@@ -532,6 +506,16 @@ class Simile:
532
506
  "reasoning": reasoning,
533
507
  }
534
508
 
509
+ # Pass memory parameters to API for server-side handling
510
+ if use_memory:
511
+ request_payload["use_memory"] = str(use_memory)
512
+ if exclude_memory_ids:
513
+ request_payload["exclude_memory_ids"] = exclude_memory_ids
514
+
515
+ if save_memory:
516
+ request_payload["save_memory"] = str(save_memory)
517
+
518
+ # Only include explicit memory_stream if provided directly
535
519
  if memory_stream:
536
520
  request_payload["memory_stream"] = memory_stream.to_dict()
537
521
 
@@ -542,27 +526,8 @@ class Simile:
542
526
  response_model=ClosedGenerationResponse,
543
527
  )
544
528
 
545
- # If save_memory is provided, save the response
546
- if save_memory and response_data:
547
- from .models import ClosedQuestionMemoryTurn
548
-
549
- memory_turn = ClosedQuestionMemoryTurn(
550
- user_question=question,
551
- user_options=options,
552
- user_images=images,
553
- llm_response=response_data.response,
554
- llm_reasoning=response_data.reasoning if reasoning else None
555
- )
556
-
557
- await self.save_memory(
558
- agent_id=agent_id,
559
- response=response_data.response,
560
- session_id=save_memory,
561
- memory_turn=memory_turn.to_dict(),
562
- memory_stream_used=memory_stream.to_dict() if memory_stream else None,
563
- reasoning=response_data.reasoning if reasoning else None,
564
- metadata={"question_type": "closed", "options": options}
565
- )
529
+ # Don't save memory here - API should handle it when save_memory is passed
530
+ # Memory saving is now handled server-side for better performance
566
531
 
567
532
  return response_data
568
533
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simile
3
- Version: 0.4.1
3
+ Version: 0.4.2
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
@@ -1,11 +1,11 @@
1
1
  simile/__init__.py,sha256=JAYtieyGg6YYiCackJ6YNlGJkFWmhryzbwwVt4K67uI,1360
2
2
  simile/auth_client.py,sha256=ICImmaA5fZX9ADbIPIUh4RED3hBZvLf3XSiaqELDAME,7923
3
- simile/client.py,sha256=bou2NijZT8XF5cBzy5zrqnwE2bmLOYqagmpXHgZYwNk,28288
3
+ simile/client.py,sha256=5I459mI1porgFKO-1RebR84r-ueJ0ePcO2SmXQwlJ9k,26920
4
4
  simile/exceptions.py,sha256=Q1lbfwR7mEn_LYmwjAnsMc8BW79JNPvmCmVoPibYisU,1502
5
5
  simile/models.py,sha256=7-meixtd7oyMAc_k24SbKPjMD05tTI0npHVKAeGFcDo,11693
6
6
  simile/resources.py,sha256=LSYZSzx1YO69xvShGxxLFVPjQHw1WukHXhdYc1EyuOs,10555
7
- simile-0.4.1.dist-info/licenses/LICENSE,sha256=tpxX3bpODfyOQVyEM6kCMvPHFCpkjFDj0AICRqKqOFA,1066
8
- simile-0.4.1.dist-info/METADATA,sha256=YGu7eL55DR7TVW5Uon8MQfJq-sxOr1blFjG0vmQDuqY,1598
9
- simile-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- simile-0.4.1.dist-info/top_level.txt,sha256=41lJneubAG4-ZOAs5qn7iDtDb-MDxa6DdvgBKwNX84M,7
11
- simile-0.4.1.dist-info/RECORD,,
7
+ simile-0.4.2.dist-info/licenses/LICENSE,sha256=tpxX3bpODfyOQVyEM6kCMvPHFCpkjFDj0AICRqKqOFA,1066
8
+ simile-0.4.2.dist-info/METADATA,sha256=vhJOWBLomz7KyebNtwMhjfrx8-pfba59dtn-A_6fdiY,1598
9
+ simile-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ simile-0.4.2.dist-info/top_level.txt,sha256=41lJneubAG4-ZOAs5qn7iDtDb-MDxa6DdvgBKwNX84M,7
11
+ simile-0.4.2.dist-info/RECORD,,
File without changes