hindsight-api 0.1.3__py3-none-any.whl → 0.1.4__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.
@@ -170,24 +170,38 @@ class LLMProvider:
170
170
  "messages": messages,
171
171
  }
172
172
 
173
- if max_completion_tokens is not None:
174
- call_params["max_completion_tokens"] = max_completion_tokens
175
173
  # Check if model supports reasoning parameter (o1, o3, gpt-5 families)
176
174
  model_lower = self.model.lower()
177
175
  is_reasoning_model = any(x in model_lower for x in ["gpt-5", "o1", "o3"])
178
176
 
177
+ # For GPT-4 and GPT-4.1 models, cap max_completion_tokens to 32000
178
+ is_gpt4_model = any(x in model_lower for x in ["gpt-4.1", "gpt-4-"])
179
+ if max_completion_tokens is not None:
180
+ if is_gpt4_model and max_completion_tokens > 32000:
181
+ max_completion_tokens = 32000
182
+ # For reasoning models, max_completion_tokens includes reasoning + output tokens
183
+ # Enforce minimum of 16000 to ensure enough space for both
184
+ if is_reasoning_model and max_completion_tokens < 16000:
185
+ max_completion_tokens = 16000
186
+ call_params["max_completion_tokens"] = max_completion_tokens
187
+
179
188
  # GPT-5/o1/o3 family doesn't support custom temperature (only default 1)
180
189
  if temperature is not None and not is_reasoning_model:
181
190
  call_params["temperature"] = temperature
182
191
 
192
+ # Set reasoning_effort for reasoning models (OpenAI gpt-5, o1, o3)
193
+ if is_reasoning_model and self.provider == "openai":
194
+ call_params["reasoning_effort"] = self.reasoning_effort
195
+
183
196
  # Provider-specific parameters
184
197
  if self.provider == "groq":
185
198
  call_params["seed"] = DEFAULT_LLM_SEED
186
- call_params["extra_body"] = {
187
- "service_tier": "auto",
188
- "reasoning_effort": self.reasoning_effort,
189
- "include_reasoning": False,
190
- }
199
+ extra_body = {"service_tier": "auto"}
200
+ # Only add reasoning parameters for reasoning models
201
+ if is_reasoning_model:
202
+ extra_body["reasoning_effort"] = self.reasoning_effort
203
+ extra_body["include_reasoning"] = False
204
+ call_params["extra_body"] = extra_body
191
205
 
192
206
  last_exception = None
193
207
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hindsight-api
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Temporal + Semantic + Entity Memory System for AI agents using PostgreSQL
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: alembic>=1.17.1
@@ -24,7 +24,7 @@ hindsight_api/engine/cross_encoder.py,sha256=D6iTTXv23R1n8O_IoAsBCsCbevZTNhnJSt4
24
24
  hindsight_api/engine/db_utils.py,sha256=p1Ne70wPP327xdPI_XjMfnagilY8sknbkhEIZuED6DU,2724
25
25
  hindsight_api/engine/embeddings.py,sha256=RdK9A3lUjp1FZFArllhTgKo70Pot4ZUEJ1Pw70BpNmk,10218
26
26
  hindsight_api/engine/entity_resolver.py,sha256=w5DPCuYNsK4GF8Qe3oY7jCKcOT1WYx2h0YD1nX0QRtA,23184
27
- hindsight_api/engine/llm_wrapper.py,sha256=9tw6ZD6O2C9gj2nlvD62yRoThmyZI-LoeFgTCuKOfKQ,20188
27
+ hindsight_api/engine/llm_wrapper.py,sha256=d1v6DdmoYfmfb6MgJbviekH2Hlo3L1bamKKE_TVNw7k,21112
28
28
  hindsight_api/engine/memory_engine.py,sha256=QDCZ4scEjkyTLtEV6XSjnRiWhew5huoEds0CHw12bvA,134924
29
29
  hindsight_api/engine/query_analyzer.py,sha256=K0QCg7tsbqtwC7TR5wt3FPoP8QDuZsX9r0Zljc8nnYo,19733
30
30
  hindsight_api/engine/response_models.py,sha256=e-_vE1zAVFLpkl6SeHIYvHcQ4Z-AaOdq0jjjhh8yHk4,8683
@@ -55,7 +55,7 @@ hindsight_api/engine/search/think_utils.py,sha256=VJJXFmBg03yO4Mg--UBMlTQW9IZOj2
55
55
  hindsight_api/engine/search/trace.py,sha256=Hx-siW9yAfqZoK9LG6esbed0vQuHMNsGxSvCg4FK6-4,11042
56
56
  hindsight_api/engine/search/tracer.py,sha256=LQ78knpMxyZmPUvm3PJNN2opCyA-LpB47JZ84n0g2pw,15074
57
57
  hindsight_api/engine/search/types.py,sha256=qIeHW_gT7f291vteTZXygAM8oAaPp2dq6uEdvOyOwzs,5488
58
- hindsight_api-0.1.3.dist-info/METADATA,sha256=oo-Sy2bJW_K5dbHAHf5xPoTAUmx1BAi_aUwetovwXIU,1466
59
- hindsight_api-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
60
- hindsight_api-0.1.3.dist-info/entry_points.txt,sha256=ZDj1gJCi6Ga6VLdPgRSrRizQ4dUTreefjeG_tO1CuHk,58
61
- hindsight_api-0.1.3.dist-info/RECORD,,
58
+ hindsight_api-0.1.4.dist-info/METADATA,sha256=voQtL9sUm15LNX0M9tiyybr-nl9SwuSZMYU2pk9kRL4,1466
59
+ hindsight_api-0.1.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
60
+ hindsight_api-0.1.4.dist-info/entry_points.txt,sha256=ZDj1gJCi6Ga6VLdPgRSrRizQ4dUTreefjeG_tO1CuHk,58
61
+ hindsight_api-0.1.4.dist-info/RECORD,,