prompty 0.1.49__tar.gz → 0.1.50__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-0.1.49 → prompty-0.1.50}/PKG-INFO +1 -1
- {prompty-0.1.49 → prompty-0.1.50}/prompty/__init__.py +2 -2
- {prompty-0.1.49 → prompty-0.1.50}/prompty/utils.py +23 -13
- {prompty-0.1.49 → prompty-0.1.50}/pyproject.toml +1 -1
- prompty-0.1.50/tests/prompts/basic_mustache.prompty +45 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_factory_invoker.py +1 -0
- {prompty-0.1.49 → prompty-0.1.50}/LICENSE +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/README.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/azure/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/azure/executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/azure/processor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/azure_beta/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/azure_beta/executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/cli.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/core.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/invoker.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/mustache.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/openai/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/openai/executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/openai/processor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/parsers.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/py.typed +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/renderers.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/serverless/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/serverless/executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/serverless/processor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/prompty/tracer.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/fake_azure_executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/fake_serverless_executor.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/1contoso.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/2contoso.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/3contoso.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/4contoso.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/basic.prompty.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/camping.jpg +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/context.prompty.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/contoso_multi.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/faithfulness.prompty.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/generated/groundedness.prompty.md +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/hello_world-goodbye_world-hello_again.embedding.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/hello_world.embedding.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/basic.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/basic.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/basic_json_output.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/camping.jpg +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/chat.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/context.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/context.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/context.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/embedding.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/embedding.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/evaluation.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/faithfulness.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/faithfulness.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/fake.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/funcfile.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/funcfile.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/functions.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/functions.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/groundedness.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/groundedness.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/prompty.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/serverless.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/serverless.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/serverless_stream.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/serverless_stream.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/streaming.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/streaming.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/structured_output.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/structured_output.prompty.execution.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/structured_output_schema.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/basic.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/sub/__init__.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/sub/basic.prompty +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/sub/prompty.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/sub/sub/test.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompts/test.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/prompty.json +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_common.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_core.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_execute.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_path_exec.py +0 -0
- {prompty-0.1.49 → prompty-0.1.50}/tests/test_tracing.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: prompty
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.50
|
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
|
License: MIT
|
@@ -67,7 +67,7 @@ def headless(
|
|
67
67
|
"""
|
68
68
|
|
69
69
|
# get caller's path (to get relative path for prompty.json)
|
70
|
-
caller = Path(traceback.extract_stack()[-
|
70
|
+
caller = Path(traceback.extract_stack()[-3].filename)
|
71
71
|
templateSettings = TemplateSettings(type="NOOP", parser="NOOP")
|
72
72
|
modelSettings = ModelSettings(
|
73
73
|
api=api,
|
@@ -124,7 +124,7 @@ async def headless_async(
|
|
124
124
|
"""
|
125
125
|
|
126
126
|
# get caller's path (to get relative path for prompty.json)
|
127
|
-
caller = Path(traceback.extract_stack()[-
|
127
|
+
caller = Path(traceback.extract_stack()[-3].filename)
|
128
128
|
templateSettings = TemplateSettings(type="NOOP", parser="NOOP")
|
129
129
|
|
130
130
|
global_config = await load_global_config_async(caller.parent, connection)
|
@@ -33,21 +33,31 @@ async def load_json_async(file_path, encoding="utf-8"):
|
|
33
33
|
return json.loads(content)
|
34
34
|
|
35
35
|
|
36
|
+
def _walk_up_path(path: Path) -> typing.Union[Path, None]:
|
37
|
+
"""Walk up the path to find a prompty.json file.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
path (Path): The path to start searching from.
|
41
|
+
"""
|
42
|
+
while path != path.parent:
|
43
|
+
# Check if the prompty.json file exists in the current directory
|
44
|
+
prompty_config = path / "prompty.json"
|
45
|
+
if prompty_config.exists():
|
46
|
+
return prompty_config
|
47
|
+
# Move up to the parent directory
|
48
|
+
path = path.parent
|
49
|
+
return None
|
50
|
+
|
51
|
+
|
36
52
|
def _find_global_config(prompty_path: Path = Path.cwd()) -> typing.Union[Path, None]:
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
for c in prompty_config
|
44
|
-
if len(c.parent.parts) <= len(prompty_path.parts)
|
45
|
-
],
|
46
|
-
key=lambda p: len(p.parts),
|
47
|
-
)
|
48
|
-
return sorted_list[-1] if len(sorted_list) > 0 else None
|
53
|
+
"""Find the prompty.json file in the current directory or any parent directory.
|
54
|
+
Args:
|
55
|
+
prompty_path (Path): The path to start searching from.
|
56
|
+
"""
|
57
|
+
if Path(prompty_path / "prompty.json").exists():
|
58
|
+
return Path(prompty_path / "prompty.json")
|
49
59
|
else:
|
50
|
-
return
|
60
|
+
return _walk_up_path(prompty_path)
|
51
61
|
|
52
62
|
|
53
63
|
def load_global_config(
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
name: Basic Prompt
|
3
|
+
description: A basic prompt that uses the GPT-3 chat API to answer questions
|
4
|
+
authors:
|
5
|
+
- sethjuarez
|
6
|
+
- jietong
|
7
|
+
model:
|
8
|
+
api: chat
|
9
|
+
configuration:
|
10
|
+
azure_deployment: gpt-35-turbo
|
11
|
+
inputs:
|
12
|
+
table:
|
13
|
+
type: string
|
14
|
+
default: sample
|
15
|
+
description: The name of the sample
|
16
|
+
firstName:
|
17
|
+
type: string
|
18
|
+
description: The first name of the customer
|
19
|
+
lastName:
|
20
|
+
type: string
|
21
|
+
default: Doe
|
22
|
+
description: The last name of the customer
|
23
|
+
template: mustache
|
24
|
+
|
25
|
+
sample:
|
26
|
+
firstName: Jane
|
27
|
+
lastName: Doe
|
28
|
+
question: What is the meaning of life?
|
29
|
+
top_n: 5
|
30
|
+
table: customers
|
31
|
+
---
|
32
|
+
system:
|
33
|
+
You are an AI assistant who helps people find information.
|
34
|
+
As the assistant, you answer questions briefly, succinctly,
|
35
|
+
and in a personable manner using markdown and even add some personal flair with appropriate emojis.
|
36
|
+
{{ query }}
|
37
|
+
|
38
|
+
{{! ignore this line from Mustache }}
|
39
|
+
|
40
|
+
# Customer
|
41
|
+
You are helping {{firstName}} {{lastName}} to find answers to their questions.
|
42
|
+
Use their name to address them in your responses.
|
43
|
+
|
44
|
+
user:
|
45
|
+
{{question}}
|
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-0.1.49 → prompty-0.1.50}/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
|