Skip to content

release: 0.1.0-alpha.7 #106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6520251
feat(api): OpenAPI spec update via Stainless API (#92)
stainless-app[bot] Jun 26, 2024
22e82e4
feat(api): OpenAPI spec update via Stainless API (#93)
stainless-app[bot] Jun 26, 2024
f63e4d5
feat(api): OpenAPI spec update via Stainless API (#94)
stainless-app[bot] Jun 27, 2024
8ef2751
feat(api): OpenAPI spec update via Stainless API (#95)
stainless-app[bot] Jun 27, 2024
8cdbe3c
feat(api): OpenAPI spec update via Stainless API (#96)
stainless-app[bot] Jun 27, 2024
753d7d3
feat(api): OpenAPI spec update via Stainless API (#97)
stainless-app[bot] Jun 27, 2024
6835317
feat(api): OpenAPI spec update via Stainless API (#98)
stainless-app[bot] Jun 27, 2024
399e45c
feat(api): OpenAPI spec update via Stainless API (#99)
stainless-app[bot] Jun 27, 2024
f83ef3e
feat(api): OpenAPI spec update via Stainless API (#100)
stainless-app[bot] Jun 27, 2024
228ed6e
feat(api): OpenAPI spec update via Stainless API (#101)
stainless-app[bot] Jun 27, 2024
7ed4791
feat(api): OpenAPI spec update via Stainless API (#102)
stainless-app[bot] Jun 27, 2024
62cbe85
feat(api): OpenAPI spec update via Stainless API (#103)
stainless-app[bot] Jun 27, 2024
37da162
feat(api): OpenAPI spec update via Stainless API (#104)
stainless-app[bot] Jun 28, 2024
2dfee4c
feat(api): OpenAPI spec update via Stainless API (#105)
stainless-app[bot] Jun 28, 2024
5abaf44
feat(api): OpenAPI spec update via Stainless API (#107)
stainless-app[bot] Jun 30, 2024
86aa7d4
feat(api): OpenAPI spec update via Stainless API (#108)
stainless-app[bot] Jun 30, 2024
1aba274
feat(api): OpenAPI spec update via Stainless API (#109)
stainless-app[bot] Jul 1, 2024
ad0fc4c
feat(api): OpenAPI spec update via Stainless API (#110)
stainless-app[bot] Jul 1, 2024
990ede2
feat(api): OpenAPI spec update via Stainless API (#111)
stainless-app[bot] Jul 1, 2024
681e957
release: 0.1.0-alpha.7
stainless-app[bot] Jul 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.prism.log
.vscode
_dev

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.6"
".": "0.1.0-alpha.7"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-d77f7f9f32373ca58fafe721c7c3bab1ba26d366ff00e7f5c59e6cf1058a9db2.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-25c225e5f2ead41f7ad3c125491dfce3cb601de352acd021ab000ca8337bee67.yml
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.1.0-alpha.7 (2024-07-01)

Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/prompt-foundry/python-sdk/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)

### Features

* **api:** OpenAPI spec update via Stainless API ([#100](https://github.com/prompt-foundry/python-sdk/issues/100)) ([f83ef3e](https://github.com/prompt-foundry/python-sdk/commit/f83ef3ef2694a695d2e25d492372fca799fe3ecc))
* **api:** OpenAPI spec update via Stainless API ([#101](https://github.com/prompt-foundry/python-sdk/issues/101)) ([228ed6e](https://github.com/prompt-foundry/python-sdk/commit/228ed6efeda0084d73c5ca6b38030f3d0a97bdc8))
* **api:** OpenAPI spec update via Stainless API ([#102](https://github.com/prompt-foundry/python-sdk/issues/102)) ([7ed4791](https://github.com/prompt-foundry/python-sdk/commit/7ed47914887bacc4d30a19526bcf71287477f4b7))
* **api:** OpenAPI spec update via Stainless API ([#103](https://github.com/prompt-foundry/python-sdk/issues/103)) ([62cbe85](https://github.com/prompt-foundry/python-sdk/commit/62cbe854b72bc6d525ef0bae71191ea4d771ba3f))
* **api:** OpenAPI spec update via Stainless API ([#104](https://github.com/prompt-foundry/python-sdk/issues/104)) ([37da162](https://github.com/prompt-foundry/python-sdk/commit/37da162797dac518f48a93768024c74b21672c1d))
* **api:** OpenAPI spec update via Stainless API ([#105](https://github.com/prompt-foundry/python-sdk/issues/105)) ([2dfee4c](https://github.com/prompt-foundry/python-sdk/commit/2dfee4c921cab92949c4a031a301abfa24240a53))
* **api:** OpenAPI spec update via Stainless API ([#107](https://github.com/prompt-foundry/python-sdk/issues/107)) ([5abaf44](https://github.com/prompt-foundry/python-sdk/commit/5abaf4495f35242048abc8a18a6fcaa01e3b7a49))
* **api:** OpenAPI spec update via Stainless API ([#108](https://github.com/prompt-foundry/python-sdk/issues/108)) ([86aa7d4](https://github.com/prompt-foundry/python-sdk/commit/86aa7d4d12c523b045551ac4e2ff468d829a429a))
* **api:** OpenAPI spec update via Stainless API ([#109](https://github.com/prompt-foundry/python-sdk/issues/109)) ([1aba274](https://github.com/prompt-foundry/python-sdk/commit/1aba274d30eb22b35cd178a1d458bb6ffac624e0))
* **api:** OpenAPI spec update via Stainless API ([#110](https://github.com/prompt-foundry/python-sdk/issues/110)) ([ad0fc4c](https://github.com/prompt-foundry/python-sdk/commit/ad0fc4cca8cb445ec5f3de7e60c8c1c86b15e1f9))
* **api:** OpenAPI spec update via Stainless API ([#111](https://github.com/prompt-foundry/python-sdk/issues/111)) ([990ede2](https://github.com/prompt-foundry/python-sdk/commit/990ede20af4b0f79369bff775625351269c8d51f))
* **api:** OpenAPI spec update via Stainless API ([#92](https://github.com/prompt-foundry/python-sdk/issues/92)) ([6520251](https://github.com/prompt-foundry/python-sdk/commit/652025167adb3b4ccb18efcae08a6bb28b36301f))
* **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/prompt-foundry/python-sdk/issues/93)) ([22e82e4](https://github.com/prompt-foundry/python-sdk/commit/22e82e465a00204c95b491fc8583fc3f4d841527))
* **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/prompt-foundry/python-sdk/issues/94)) ([f63e4d5](https://github.com/prompt-foundry/python-sdk/commit/f63e4d5acd214ce3cc04fa83f65ab04371806128))
* **api:** OpenAPI spec update via Stainless API ([#95](https://github.com/prompt-foundry/python-sdk/issues/95)) ([8ef2751](https://github.com/prompt-foundry/python-sdk/commit/8ef2751ed5afc1f3fc7d2e501905842fba3ce83f))
* **api:** OpenAPI spec update via Stainless API ([#96](https://github.com/prompt-foundry/python-sdk/issues/96)) ([8cdbe3c](https://github.com/prompt-foundry/python-sdk/commit/8cdbe3c64e94516e76fae1e8657d06fb8731aee0))
* **api:** OpenAPI spec update via Stainless API ([#97](https://github.com/prompt-foundry/python-sdk/issues/97)) ([753d7d3](https://github.com/prompt-foundry/python-sdk/commit/753d7d3043abbe0ffd0dc278e1b1fda2267abb86))
* **api:** OpenAPI spec update via Stainless API ([#98](https://github.com/prompt-foundry/python-sdk/issues/98)) ([6835317](https://github.com/prompt-foundry/python-sdk/commit/6835317eb720fbe3d7087779065e64c7ef460f37))
* **api:** OpenAPI spec update via Stainless API ([#99](https://github.com/prompt-foundry/python-sdk/issues/99)) ([399e45c](https://github.com/prompt-foundry/python-sdk/commit/399e45ca490b18d991055064666afc62bfcaf408))

## 0.1.0-alpha.6 (2024-06-26)

Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/prompt-foundry/python-sdk/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ response = client.prompts.with_raw_response.get_parameters(
print(response.headers.get('X-My-Header'))

prompt = response.parse() # get the object that `prompts.get_parameters()` would have returned
print(prompt.provider)
print(prompt)
```

These methods return an [`APIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt_foundry_python_sdk/_response.py) object.
Expand Down
18 changes: 17 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "prompt_foundry_python_sdk"
version = "0.1.0-alpha.6"
version = "0.1.0-alpha.7"
description = "The prompt engineering, prompt management, and prompt evaluation tool for Python "
keywords = ["llm evaluation", "prompt management", "prompt testing", "prompt engineering"]
dynamic = ["readme"]
Expand Down Expand Up @@ -60,6 +60,7 @@ dev-dependencies = [
"nox",
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",

]

Expand Down Expand Up @@ -101,6 +102,21 @@ include = [
[tool.hatch.build.targets.wheel]
packages = ["src/prompt_foundry_python_sdk"]

[tool.hatch.build.targets.sdist]
# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc)
include = [
"/*.toml",
"/*.json",
"/*.lock",
"/*.md",
"/mypy.ini",
"/noxfile.py",
"bin/*",
"examples/*",
"src/*",
"tests/*",
]

[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"

Expand Down
10 changes: 9 additions & 1 deletion requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-e file:.
annotated-types==0.6.0
# via pydantic
anyio==4.1.0
anyio==4.4.0
# via httpx
# via prompt-foundry-python-sdk
argcomplete==3.1.2
Expand Down Expand Up @@ -44,6 +44,10 @@ idna==3.4
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.7.1
mypy-extensions==1.0.0
# via mypy
Expand All @@ -63,6 +67,8 @@ pydantic==2.7.1
# via prompt-foundry-python-sdk
pydantic-core==2.18.2
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.364
pytest==7.1.1
# via pytest-asyncio
Expand All @@ -72,6 +78,7 @@ python-dateutil==2.8.2
pytz==2023.3.post1
# via dirty-equals
respx==0.20.2
rich==13.7.1
ruff==0.1.9
setuptools==68.2.2
# via nodeenv
Expand All @@ -86,6 +93,7 @@ tomli==2.0.1
# via mypy
# via pytest
typing-extensions==4.8.0
# via anyio
# via mypy
# via prompt-foundry-python-sdk
# via pydantic
Expand Down
3 changes: 2 additions & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-e file:.
annotated-types==0.6.0
# via pydantic
anyio==4.1.0
anyio==4.4.0
# via httpx
# via prompt-foundry-python-sdk
certifi==2023.7.22
Expand Down Expand Up @@ -38,6 +38,7 @@ sniffio==1.3.0
# via httpx
# via prompt-foundry-python-sdk
typing-extensions==4.8.0
# via anyio
# via prompt-foundry-python-sdk
# via pydantic
# via pydantic-core
5 changes: 4 additions & 1 deletion src/prompt_foundry_python_sdk/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@
maybe_transform as maybe_transform,
async_maybe_transform as async_maybe_transform,
)
from ._reflection import function_has_argument as function_has_argument
from ._reflection import (
function_has_argument as function_has_argument,
assert_signatures_in_sync as assert_signatures_in_sync,
)
34 changes: 34 additions & 0 deletions src/prompt_foundry_python_sdk/_utils/_reflection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import inspect
from typing import Any, Callable

Expand All @@ -6,3 +8,35 @@ def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool:
"""Returns whether or not the given function has a specific parameter"""
sig = inspect.signature(func)
return arg_name in sig.parameters


def assert_signatures_in_sync(
source_func: Callable[..., Any],
check_func: Callable[..., Any],
*,
exclude_params: set[str] = set(),
) -> None:
"""Ensure that the signature of the second function matches the first."""

check_sig = inspect.signature(check_func)
source_sig = inspect.signature(source_func)

errors: list[str] = []

for name, source_param in source_sig.parameters.items():
if name in exclude_params:
continue

custom_param = check_sig.parameters.get(name)
if not custom_param:
errors.append(f"the `{name}` param is missing")
continue

if custom_param.annotation != source_param.annotation:
errors.append(
f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(source_param.annotation)}"
)
continue

if errors:
raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors))
2 changes: 1 addition & 1 deletion src/prompt_foundry_python_sdk/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "prompt_foundry_python_sdk"
__version__ = "0.1.0-alpha.6" # x-release-please-version
__version__ = "0.1.0-alpha.7" # x-release-please-version
16 changes: 8 additions & 8 deletions src/prompt_foundry_python_sdk/resources/evaluation_assertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def create(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: str,
target_value: Optional[str],
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -105,10 +105,10 @@ def update(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: str,
target_value: Optional[str],
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -277,10 +277,10 @@ async def create(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: str,
target_value: Optional[str],
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -333,10 +333,10 @@ async def update(
*,
evaluation_id: str,
json_path: Optional[str],
target_value: str,
target_value: Optional[str],
tool_name: Optional[str],
type: Literal[
"EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"
"CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"
],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down
64 changes: 35 additions & 29 deletions src/prompt_foundry_python_sdk/resources/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Dict, Iterable, Optional
from typing import Any, Dict, Iterable, Optional, cast

import httpx

Expand Down Expand Up @@ -257,21 +257,24 @@ def get_parameters(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
f"/sdk/v1/prompts/{id}",
body=maybe_transform(
{
"append_messages": append_messages,
"override_messages": override_messages,
"user": user,
"variables": variables,
},
prompt_get_parameters_params.PromptGetParametersParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
return cast(
ModelParameters,
self._post(
f"/sdk/v1/prompts/{id}",
body=maybe_transform(
{
"append_messages": append_messages,
"override_messages": override_messages,
"user": user,
"variables": variables,
},
prompt_get_parameters_params.PromptGetParametersParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(Any, ModelParameters), # Union types cannot be passed in as arguments in the type system
),
cast_to=ModelParameters,
)


Expand Down Expand Up @@ -501,21 +504,24 @@ async def get_parameters(
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
f"/sdk/v1/prompts/{id}",
body=await async_maybe_transform(
{
"append_messages": append_messages,
"override_messages": override_messages,
"user": user,
"variables": variables,
},
prompt_get_parameters_params.PromptGetParametersParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
return cast(
ModelParameters,
await self._post(
f"/sdk/v1/prompts/{id}",
body=await async_maybe_transform(
{
"append_messages": append_messages,
"override_messages": override_messages,
"user": user,
"variables": variables,
},
prompt_get_parameters_params.PromptGetParametersParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(Any, ModelParameters), # Union types cannot be passed in as arguments in the type system
),
cast_to=ModelParameters,
)


Expand Down
2 changes: 1 addition & 1 deletion src/prompt_foundry_python_sdk/types/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppendedMessage(BaseModel):
content: Optional[str] = None
"""Example: "Hello, {{city}}!" """

role: Literal["user", "assistant", "system", "tool"]
role: Literal["assistant", "system", "tool", "user"]

tool_call_id: Optional[str] = FieldInfo(alias="toolCallId", default=None)

Expand Down
4 changes: 2 additions & 2 deletions src/prompt_foundry_python_sdk/types/evaluation_assertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class EvaluationAssertion(BaseModel):
Only required when type is `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
"""

target_value: str = FieldInfo(alias="targetValue")
target_value: Optional[str] = FieldInfo(alias="targetValue", default=None)

tool_name: Optional[str] = FieldInfo(alias="toolName", default=None)
"""The name of the tool to match.

Only required when type is `TOOL_CALLED` or `TOOL_CALLED_WITH`.
"""

type: Literal["EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"]
type: Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
"""The type of evaluation matcher to use."""
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EvaluationAssertionCreateParams(TypedDict, total=False):
Only required when type is `JSON_EXACT_MATCH` or `JSON_CONTAINS`.
"""

target_value: Required[Annotated[str, PropertyInfo(alias="targetValue")]]
target_value: Required[Annotated[Optional[str], PropertyInfo(alias="targetValue")]]

tool_name: Required[Annotated[Optional[str], PropertyInfo(alias="toolName")]]
"""The name of the tool to match.
Expand All @@ -28,6 +28,6 @@ class EvaluationAssertionCreateParams(TypedDict, total=False):
"""

type: Required[
Literal["EXACT_MATCH", "CONTAINS", "JSON_EXACT_MATCH", "JSON_CONTAINS", "TOOL_CALLED", "TOOL_CALLED_WITH"]
Literal["CONTAINS", "EXACT_MATCH", "JSON_CONTAINS", "JSON_EXACT_MATCH", "TOOL_CALLED", "TOOL_CALLED_WITH"]
]
"""The type of evaluation matcher to use."""
Loading