prompty 1.0.0b1__tar.gz → 1.0.0b3__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.
- {prompty-1.0.0b1 → prompty-1.0.0b3}/PKG-INFO +1 -1
- prompty-1.0.0b3/prompty/_version.py +1 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/azure/executor.py +6 -6
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/cli.py +2 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/core.py +4 -4
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/invoker.py +2 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/tracer.py +3 -1
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_agent.py +7 -1
- prompty-1.0.0b1/prompty/_version.py +0 -1
- {prompty-1.0.0b1 → prompty-1.0.0b3}/.gitignore +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/.vscode/settings.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/LICENSE +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/README.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/azure/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/azure/processor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/common.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/openai/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/openai/executor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/openai/processor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/parsers.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/py.typed +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/renderers.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/serverless/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/serverless/executor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/serverless/processor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/prompty/utils.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/pyproject.toml +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/agent/simple_agent.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/agent/simple_agent.prompty.1.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/agent/simple_agent.prompty.2.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/coverage.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/fake_azure_executor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/fake_serverless_executor.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/1contoso.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/2contoso.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/3contoso.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/4contoso.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/basic.prompty.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/camping.jpg +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/context.prompty.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/contoso_multi.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/faithfulness.prompty.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/generated/groundedness.prompty.md +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/hello_world-goodbye_world-hello_again.embedding.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/hello_world.embedding.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/mustache/basic.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/agent.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/basic.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/basic.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/basic_json_output.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/basic_mustache.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/camping.jpg +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/chat.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/context.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/context.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/context.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/embedding.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/embedding.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/evaluation.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/faithfulness.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/faithfulness.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/fake.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/func_inline.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/funcfile.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/funcfile.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/functions.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/functions.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/groundedness.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/groundedness.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/prompty.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/serverless.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/serverless.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/serverless_stream.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/serverless_stream.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/streaming.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/streaming.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/structured_complex.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/structured_inline.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/structured_output.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/structured_output_schema.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/basic.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/sub/__init__.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/sub/basic.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/sub/prompty.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/sub/sub/test.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/test.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompts/threaded_chat.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/prompty.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/properties/basic_array.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/properties/basic_dictionary.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/properties/basic_mixed.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/properties/thread_split.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex_other.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex_other.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_inline.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_inline.prompty.execution.json +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_common.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_conversion.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_core.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_execute.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_factory_invoker.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_mustache.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_parser.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_path_exec.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_tools.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/test_tracing.py +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/tools/basic.prompty +0 -0
- {prompty-1.0.0b1 → prompty-1.0.0b3}/tests/tools/dynamic.prompty +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: prompty
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.0b3
|
4
4
|
Summary: Prompty is a new asset class and format for LLM prompts that aims to provide observability, understandability, and portability for developers. It includes spec, tooling, and a runtime. This Prompty runtime supports Python
|
5
5
|
Author-email: Seth Juarez <seth.juarez@microsoft.com>
|
6
6
|
Requires-Python: >=3.9
|
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = "1.0.0b3"
|
@@ -226,10 +226,10 @@ class AzureOpenAIExecutor(Invoker):
|
|
226
226
|
return tool
|
227
227
|
|
228
228
|
def _execute_agent(self, client: AzureOpenAI, data: typing.Any) -> typing.Any:
|
229
|
-
with Tracer.start("
|
230
|
-
trace("type", "
|
229
|
+
with Tracer.start("AgentLoop") as trace:
|
230
|
+
trace("type", "agent")
|
231
231
|
trace("description", "Azure OpenAI Client")
|
232
|
-
trace("signature", "
|
232
|
+
trace("signature", "prompty.azure.AzureOpenAIExecutor.AgentLoop")
|
233
233
|
|
234
234
|
trace("inputs", data)
|
235
235
|
|
@@ -276,10 +276,10 @@ class AzureOpenAIExecutor(Invoker):
|
|
276
276
|
return response
|
277
277
|
|
278
278
|
async def _execute_agent_async(self, client: AsyncAzureOpenAI, data: typing.Any) -> typing.Any:
|
279
|
-
with Tracer.start("
|
280
|
-
trace("type", "
|
279
|
+
with Tracer.start("AgentLoopAsync") as trace:
|
280
|
+
trace("type", "agent")
|
281
281
|
trace("description", "Azure OpenAI Client")
|
282
|
-
trace("signature", "
|
282
|
+
trace("signature", "prompty.azure.AzureOpenAIExecutor.AgentLoopAsync")
|
283
283
|
|
284
284
|
trace("inputs", data)
|
285
285
|
|
@@ -99,6 +99,8 @@ def execute(prompt_path: str, inputs: Optional[dict[str, Any]] = None, raw=False
|
|
99
99
|
print("\n", json.dumps(asdict(result), indent=4), "\n")
|
100
100
|
elif isinstance(result, list):
|
101
101
|
print("\n", json.dumps([asdict(item) for item in result], indent=4), "\n")
|
102
|
+
elif isinstance(result, dict):
|
103
|
+
print("\n", json.dumps(result, indent=4), "\n")
|
102
104
|
else:
|
103
105
|
print("\n", result, "\n")
|
104
106
|
except Exception as e:
|
@@ -206,13 +206,13 @@ class Prompty:
|
|
206
206
|
# template
|
207
207
|
template: TemplateProperty = field(default_factory=TemplateProperty)
|
208
208
|
|
209
|
-
|
209
|
+
# yaml based instructions
|
210
210
|
instructions: str = field(default="")
|
211
211
|
additional_instructions: str = field(default="")
|
212
|
-
content: Union[str, list[str], dict] = field(default="")
|
213
|
-
instructions = field(default="")
|
214
|
-
additional_instructions = field(default="")
|
215
212
|
|
213
|
+
# internal properties
|
214
|
+
file: Union[str, Path] = field(default="")
|
215
|
+
content: Union[str, list[str], dict] = field(default="")
|
216
216
|
slots: list[dict[str, str]] = field(default_factory=list)
|
217
217
|
|
218
218
|
def get_input(self, name: str) -> Union[InputProperty, None]:
|
@@ -180,6 +180,7 @@ class Renderer(Invoker):
|
|
180
180
|
def __init__(self, prompty: Prompty) -> None:
|
181
181
|
super().__init__(prompty)
|
182
182
|
|
183
|
+
@trace
|
183
184
|
def run(self, data: typing.Any) -> typing.Any:
|
184
185
|
"""Method to run the invoker
|
185
186
|
|
@@ -201,6 +202,7 @@ class Renderer(Invoker):
|
|
201
202
|
|
202
203
|
return self.invoke(data)
|
203
204
|
|
205
|
+
@trace
|
204
206
|
async def run_async(self, data: typing.Any) -> typing.Any:
|
205
207
|
"""Method to run the invoker asynchronously
|
206
208
|
|
@@ -107,7 +107,9 @@ def _name(func: Callable, args):
|
|
107
107
|
signature = f"{func.__module__}.{func.__name__}"
|
108
108
|
|
109
109
|
# core invoker gets special treatment prompty.invoker.Invoker
|
110
|
-
core_invoker = signature.startswith("prompty.invoker.
|
110
|
+
core_invoker = signature.startswith("prompty.invoker.") and (
|
111
|
+
signature.endswith("run") or signature.endswith("run_async")
|
112
|
+
)
|
111
113
|
if core_invoker:
|
112
114
|
name = type(args[0]).__name__
|
113
115
|
if signature.endswith("async"):
|
@@ -10,7 +10,7 @@ import prompty
|
|
10
10
|
from prompty.azure import AzureOpenAIProcessor
|
11
11
|
from prompty.invoker import InvokerFactory
|
12
12
|
from prompty.serverless import ServerlessProcessor
|
13
|
-
from prompty.tracer import trace
|
13
|
+
from prompty.tracer import PromptyTracer, Tracer, console_tracer, trace
|
14
14
|
from tests.fake_serverless_executor import FakeServerlessExecutor
|
15
15
|
|
16
16
|
load_dotenv()
|
@@ -40,7 +40,12 @@ def fake_azure_executor():
|
|
40
40
|
InvokerFactory.add_executor("serverless", FakeServerlessExecutor)
|
41
41
|
InvokerFactory.add_processor("serverless", ServerlessProcessor)
|
42
42
|
|
43
|
+
Tracer.add("console", console_tracer)
|
44
|
+
json_tracer = PromptyTracer()
|
45
|
+
Tracer.add("PromptyTracer", json_tracer.tracer)
|
43
46
|
|
47
|
+
|
48
|
+
@trace
|
44
49
|
@pytest.mark.parametrize(
|
45
50
|
"prompt",
|
46
51
|
[
|
@@ -59,6 +64,7 @@ def test_execute_agent(prompt: str):
|
|
59
64
|
return result
|
60
65
|
|
61
66
|
|
67
|
+
@trace
|
62
68
|
@pytest.mark.asyncio
|
63
69
|
@pytest.mark.parametrize(
|
64
70
|
"prompt",
|
@@ -1 +0,0 @@
|
|
1
|
-
VERSION = "1.0.0b1"
|
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
|
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
|
File without changes
|
File without changes
|
{prompty-1.0.0b1 → prompty-1.0.0b3}/tests/hello_world-goodbye_world-hello_again.embedding.json
RENAMED
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
|
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
|
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
|
File without changes
|
{prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex.prompty.execution.json
RENAMED
File without changes
|
File without changes
|
{prompty-1.0.0b1 → prompty-1.0.0b3}/tests/response/structured_complex_other.prompty.execution.json
RENAMED
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
|