freeplay 0.3.10__tar.gz → 0.3.11__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.
- {freeplay-0.3.10 → freeplay-0.3.11}/PKG-INFO +1 -1
- {freeplay-0.3.10 → freeplay-0.3.11}/pyproject.toml +1 -1
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/prompts.py +14 -6
- {freeplay-0.3.10 → freeplay-0.3.11}/LICENSE +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/README.md +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/__init__.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/api_support.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/errors.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/freeplay.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/freeplay_cli.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/llm_parameters.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/model.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/py.typed +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/__init__.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/customer_feedback.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/recordings.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/sessions.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/resources/test_runs.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/support.py +0 -0
- {freeplay-0.3.10 → freeplay-0.3.11}/src/freeplay/utils.py +0 -0
@@ -4,7 +4,7 @@ import logging
|
|
4
4
|
from abc import ABC, abstractmethod
|
5
5
|
from dataclasses import asdict, dataclass
|
6
6
|
from pathlib import Path
|
7
|
-
from typing import Dict, Optional, List, cast, Any, Union, runtime_checkable, Protocol
|
7
|
+
from typing import Dict, Optional, List, Sequence, cast, Any, Union, runtime_checkable, Protocol
|
8
8
|
|
9
9
|
from freeplay.errors import FreeplayConfigurationError, FreeplayClientError, log_freeplay_client_warning
|
10
10
|
from freeplay.llm_parameters import LLMParameters
|
@@ -211,12 +211,15 @@ class TemplatePrompt:
|
|
211
211
|
self.tool_schema = tool_schema
|
212
212
|
self.messages = messages
|
213
213
|
|
214
|
-
def bind(self, variables: InputVariables, history: Optional[
|
214
|
+
def bind(self, variables: InputVariables, history: Optional[Sequence[GenericProviderMessage]] = None) -> BoundPrompt:
|
215
215
|
# check history for a system message
|
216
216
|
history_clean = []
|
217
217
|
if history:
|
218
|
-
for
|
219
|
-
|
218
|
+
template_messages_contain_system = any(message.get('role') == 'system' for message in self.messages)
|
219
|
+
history_dict = [convert_provider_message_to_dict(msg) for msg in history]
|
220
|
+
for msg in history_dict:
|
221
|
+
history_has_system = msg.get('role', None) == 'system'
|
222
|
+
if history_has_system and template_messages_contain_system:
|
220
223
|
log_freeplay_client_warning("System message found in history, and prompt template."
|
221
224
|
"Removing system message from the history")
|
222
225
|
else:
|
@@ -341,7 +344,12 @@ class FilesystemTemplateResolver(TemplateResolver):
|
|
341
344
|
params=metadata.get('params'),
|
342
345
|
provider_info=metadata.get('provider_info')
|
343
346
|
),
|
344
|
-
project_id=str(json_dom.get('project_id'))
|
347
|
+
project_id=str(json_dom.get('project_id')),
|
348
|
+
tool_schema=[ToolSchema(
|
349
|
+
name=schema.get('name'),
|
350
|
+
description=schema.get('description'),
|
351
|
+
parameters=schema.get('parameters')
|
352
|
+
) for schema in json_dom.get('tool_schema', [])] if json_dom.get('tool_schema') else None
|
345
353
|
)
|
346
354
|
else:
|
347
355
|
metadata = json_dom['metadata']
|
@@ -518,7 +526,7 @@ class Prompts:
|
|
518
526
|
template_name: str,
|
519
527
|
environment: str,
|
520
528
|
variables: InputVariables,
|
521
|
-
history: Optional[
|
529
|
+
history: Optional[Sequence[GenericProviderMessage]] = None,
|
522
530
|
flavor_name: Optional[str] = None
|
523
531
|
) -> FormattedPrompt:
|
524
532
|
bound_prompt = self.get(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|