Skip to content

feat(api): OpenAPI spec update via Stainless API #228

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 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-9cff8ea13f14bd0899df69243fe78b4f88d4d0172263aa260af1ea66a7d0484e.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prompt-foundry%2Fprompt-foundry-sdk-84eb1e848fd165a965df78740df71651a8b413f023e5fdb6eb1acb9cce08e006.yml
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ response = client.completion.with_raw_response.create(
print(response.headers.get('X-My-Header'))

completion = response.parse() # get the object that `completion.create()` would have returned
print(completion.message)
print(completion.provider)
```

These methods return an [`APIResponse`](https://github.com/prompt-foundry/python-sdk/tree/main/src/prompt_foundry_python_sdk/_response.py) object.
Expand Down
14 changes: 8 additions & 6 deletions src/prompt_foundry_python_sdk/resources/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,10 @@ def get_parameters(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Parameters:
"""
Fetches the model configuration parameters for a specified prompt, including
penalty settings, response format, and the model messages rendered with the
given variables mapped to the set LLM provider.
Fetches the configured model parameters and messages rendered with the provided
variables mapped to the set LLM provider. This endpoint abstracts the need to
handle mapping between different providers, while still allowing direct calls to
the providers.

Args:
append_messages: Appended the the end of the configured prompt messages before running the
Expand Down Expand Up @@ -477,9 +478,10 @@ async def get_parameters(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Parameters:
"""
Fetches the model configuration parameters for a specified prompt, including
penalty settings, response format, and the model messages rendered with the
given variables mapped to the set LLM provider.
Fetches the configured model parameters and messages rendered with the provided
variables mapped to the set LLM provider. This endpoint abstracts the need to
handle mapping between different providers, while still allowing direct calls to
the providers.

Args:
append_messages: Appended the the end of the configured prompt messages before running the
Expand Down
12 changes: 6 additions & 6 deletions src/prompt_foundry_python_sdk/types/completion_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"CompletionCreateParams",
"AppendMessage",
"AppendMessageContent",
"AppendMessageContentTextContentBlockSchema",
"AppendMessageContentTextContentBlock",
"AppendMessageContentImageBase64ContentBlock",
"AppendMessageContentToolCallContentBlock",
"AppendMessageContentToolCallContentBlockToolCall",
"AppendMessageContentToolCallContentBlockToolCallFunction",
"AppendMessageContentToolResultContentBlock",
"OverrideMessage",
"OverrideMessageContent",
"OverrideMessageContentTextContentBlockSchema",
"OverrideMessageContentTextContentBlock",
"OverrideMessageContentImageBase64ContentBlock",
"OverrideMessageContentToolCallContentBlock",
"OverrideMessageContentToolCallContentBlockToolCall",
Expand Down Expand Up @@ -48,7 +48,7 @@ class CompletionCreateParams(TypedDict, total=False):
"""The template variables added to the prompt when executing the prompt."""


class AppendMessageContentTextContentBlockSchema(TypedDict, total=False):
class AppendMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -100,7 +100,7 @@ class AppendMessageContentToolResultContentBlock(TypedDict, total=False):


AppendMessageContent: TypeAlias = Union[
AppendMessageContentTextContentBlockSchema,
AppendMessageContentTextContentBlock,
AppendMessageContentImageBase64ContentBlock,
AppendMessageContentToolCallContentBlock,
AppendMessageContentToolResultContentBlock,
Expand All @@ -113,7 +113,7 @@ class AppendMessage(TypedDict, total=False):
role: Required[Literal["assistant", "system", "tool", "user"]]


class OverrideMessageContentTextContentBlockSchema(TypedDict, total=False):
class OverrideMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -165,7 +165,7 @@ class OverrideMessageContentToolResultContentBlock(TypedDict, total=False):


OverrideMessageContent: TypeAlias = Union[
OverrideMessageContentTextContentBlockSchema,
OverrideMessageContentTextContentBlock,
OverrideMessageContentImageBase64ContentBlock,
OverrideMessageContentToolCallContentBlock,
OverrideMessageContentToolResultContentBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"CompletionCreateResponse",
"Message",
"MessageContent",
"MessageContentTextContentBlockSchema",
"MessageContentTextContentBlock",
"MessageContentImageBase64ContentBlock",
"MessageContentToolCallContentBlock",
"MessageContentToolCallContentBlockToolCall",
Expand All @@ -22,7 +22,7 @@
]


class MessageContentTextContentBlockSchema(BaseModel):
class MessageContentTextContentBlock(BaseModel):
text: str

type: Literal["TEXT"]
Expand Down Expand Up @@ -75,7 +75,7 @@ class MessageContentToolResultContentBlock(BaseModel):

MessageContent: TypeAlias = Annotated[
Union[
MessageContentTextContentBlockSchema,
MessageContentTextContentBlock,
MessageContentImageBase64ContentBlock,
MessageContentToolCallContentBlock,
MessageContentToolResultContentBlock,
Expand Down Expand Up @@ -108,4 +108,9 @@ class CompletionCreateResponse(BaseModel):
message: Message
"""The completion message generated by the model."""

name: str

provider: Literal["ANTHROPIC", "OPENAI"]
"""The LLM model provider."""

stats: Stats
6 changes: 3 additions & 3 deletions src/prompt_foundry_python_sdk/types/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Evaluation",
"AppendedMessage",
"AppendedMessageContent",
"AppendedMessageContentTextContentBlockSchema",
"AppendedMessageContentTextContentBlock",
"AppendedMessageContentImageBase64ContentBlock",
"AppendedMessageContentToolCallContentBlock",
"AppendedMessageContentToolCallContentBlockToolCall",
Expand All @@ -21,7 +21,7 @@
]


class AppendedMessageContentTextContentBlockSchema(BaseModel):
class AppendedMessageContentTextContentBlock(BaseModel):
text: str

type: Literal["TEXT"]
Expand Down Expand Up @@ -74,7 +74,7 @@ class AppendedMessageContentToolResultContentBlock(BaseModel):

AppendedMessageContent: TypeAlias = Annotated[
Union[
AppendedMessageContentTextContentBlockSchema,
AppendedMessageContentTextContentBlock,
AppendedMessageContentImageBase64ContentBlock,
AppendedMessageContentToolCallContentBlock,
AppendedMessageContentToolResultContentBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"EvaluationCreateParams",
"AppendedMessage",
"AppendedMessageContent",
"AppendedMessageContentTextContentBlockSchema",
"AppendedMessageContentTextContentBlock",
"AppendedMessageContentImageBase64ContentBlock",
"AppendedMessageContentToolCallContentBlock",
"AppendedMessageContentToolCallContentBlockToolCall",
Expand All @@ -36,7 +36,7 @@ class EvaluationCreateParams(TypedDict, total=False):
"""How heavily to weigh the evaluation within the prompt."""


class AppendedMessageContentTextContentBlockSchema(TypedDict, total=False):
class AppendedMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -88,7 +88,7 @@ class AppendedMessageContentToolResultContentBlock(TypedDict, total=False):


AppendedMessageContent: TypeAlias = Union[
AppendedMessageContentTextContentBlockSchema,
AppendedMessageContentTextContentBlock,
AppendedMessageContentImageBase64ContentBlock,
AppendedMessageContentToolCallContentBlock,
AppendedMessageContentToolResultContentBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"EvaluationUpdateParams",
"AppendedMessage",
"AppendedMessageContent",
"AppendedMessageContentTextContentBlockSchema",
"AppendedMessageContentTextContentBlock",
"AppendedMessageContentImageBase64ContentBlock",
"AppendedMessageContentToolCallContentBlock",
"AppendedMessageContentToolCallContentBlockToolCall",
Expand All @@ -36,7 +36,7 @@ class EvaluationUpdateParams(TypedDict, total=False):
"""How heavily to weigh the evaluation within the prompt."""


class AppendedMessageContentTextContentBlockSchema(TypedDict, total=False):
class AppendedMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -88,7 +88,7 @@ class AppendedMessageContentToolResultContentBlock(TypedDict, total=False):


AppendedMessageContent: TypeAlias = Union[
AppendedMessageContentTextContentBlockSchema,
AppendedMessageContentTextContentBlock,
AppendedMessageContentImageBase64ContentBlock,
AppendedMessageContentToolCallContentBlock,
AppendedMessageContentToolResultContentBlock,
Expand Down
16 changes: 8 additions & 8 deletions src/prompt_foundry_python_sdk/types/prompt_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"PromptConfiguration",
"Message",
"MessageContent",
"MessageContentTextContentBlockSchema",
"MessageContentTextContentBlock",
"MessageContentImageBase64ContentBlock",
"MessageContentToolCallContentBlock",
"MessageContentToolCallContentBlockToolCall",
Expand All @@ -23,7 +23,7 @@
]


class MessageContentTextContentBlockSchema(BaseModel):
class MessageContentTextContentBlock(BaseModel):
text: str

type: Literal["TEXT"]
Expand Down Expand Up @@ -76,7 +76,7 @@ class MessageContentToolResultContentBlock(BaseModel):

MessageContent: TypeAlias = Annotated[
Union[
MessageContentTextContentBlockSchema,
MessageContentTextContentBlock,
MessageContentImageBase64ContentBlock,
MessageContentToolCallContentBlock,
MessageContentToolResultContentBlock,
Expand All @@ -98,17 +98,17 @@ class Parameters(BaseModel):
max_tokens: Optional[float] = FieldInfo(alias="maxTokens", default=None)
"""Example: 100"""

api_model_name: str = FieldInfo(alias="modelName")
"""Example: "gpt-3.5-turbo" """

api_model_provider: Literal["ANTHROPIC", "OPENAI"] = FieldInfo(alias="modelProvider")
"""The provider of the provided model."""
name: str
"""The name of the model for the provider."""

parallel_tool_calls: bool = FieldInfo(alias="parallelToolCalls")

presence_penalty: float = FieldInfo(alias="presencePenalty")
"""Example: 0"""

provider: Literal["ANTHROPIC", "OPENAI"]
"""The LLM model provider."""

response_format: Literal["JSON", "TEXT"] = FieldInfo(alias="responseFormat")
"""Example: PromptResponseFormat.TEXT"""

Expand Down
16 changes: 8 additions & 8 deletions src/prompt_foundry_python_sdk/types/prompt_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"PromptCreateParams",
"Message",
"MessageContent",
"MessageContentTextContentBlockSchema",
"MessageContentTextContentBlock",
"MessageContentImageBase64ContentBlock",
"MessageContentToolCallContentBlock",
"MessageContentToolCallContentBlockToolCall",
Expand All @@ -32,7 +32,7 @@ class PromptCreateParams(TypedDict, total=False):
tools: Required[Iterable[Tool]]


class MessageContentTextContentBlockSchema(TypedDict, total=False):
class MessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -84,7 +84,7 @@ class MessageContentToolResultContentBlock(TypedDict, total=False):


MessageContent: TypeAlias = Union[
MessageContentTextContentBlockSchema,
MessageContentTextContentBlock,
MessageContentImageBase64ContentBlock,
MessageContentToolCallContentBlock,
MessageContentToolResultContentBlock,
Expand All @@ -106,17 +106,17 @@ class Parameters(TypedDict, total=False):
max_tokens: Required[Annotated[Optional[float], PropertyInfo(alias="maxTokens")]]
"""Example: 100"""

model_name: Required[Annotated[str, PropertyInfo(alias="modelName")]]
"""Example: "gpt-3.5-turbo" """

model_provider: Required[Annotated[Literal["ANTHROPIC", "OPENAI"], PropertyInfo(alias="modelProvider")]]
"""The provider of the provided model."""
name: Required[str]
"""The name of the model for the provider."""

parallel_tool_calls: Required[Annotated[bool, PropertyInfo(alias="parallelToolCalls")]]

presence_penalty: Required[Annotated[float, PropertyInfo(alias="presencePenalty")]]
"""Example: 0"""

provider: Required[Literal["ANTHROPIC", "OPENAI"]]
"""The LLM model provider."""

response_format: Required[Annotated[Literal["JSON", "TEXT"], PropertyInfo(alias="responseFormat")]]
"""Example: PromptResponseFormat.TEXT"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"PromptGetParametersParams",
"AppendMessage",
"AppendMessageContent",
"AppendMessageContentTextContentBlockSchema",
"AppendMessageContentTextContentBlock",
"AppendMessageContentImageBase64ContentBlock",
"AppendMessageContentToolCallContentBlock",
"AppendMessageContentToolCallContentBlockToolCall",
"AppendMessageContentToolCallContentBlockToolCallFunction",
"AppendMessageContentToolResultContentBlock",
"OverrideMessage",
"OverrideMessageContent",
"OverrideMessageContentTextContentBlockSchema",
"OverrideMessageContentTextContentBlock",
"OverrideMessageContentImageBase64ContentBlock",
"OverrideMessageContentToolCallContentBlock",
"OverrideMessageContentToolCallContentBlockToolCall",
Expand Down Expand Up @@ -48,7 +48,7 @@ class PromptGetParametersParams(TypedDict, total=False):
"""The template variables added to the prompt when executing the prompt."""


class AppendMessageContentTextContentBlockSchema(TypedDict, total=False):
class AppendMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -100,7 +100,7 @@ class AppendMessageContentToolResultContentBlock(TypedDict, total=False):


AppendMessageContent: TypeAlias = Union[
AppendMessageContentTextContentBlockSchema,
AppendMessageContentTextContentBlock,
AppendMessageContentImageBase64ContentBlock,
AppendMessageContentToolCallContentBlock,
AppendMessageContentToolResultContentBlock,
Expand All @@ -113,7 +113,7 @@ class AppendMessage(TypedDict, total=False):
role: Required[Literal["assistant", "system", "tool", "user"]]


class OverrideMessageContentTextContentBlockSchema(TypedDict, total=False):
class OverrideMessageContentTextContentBlock(TypedDict, total=False):
text: Required[str]

type: Required[Literal["TEXT"]]
Expand Down Expand Up @@ -165,7 +165,7 @@ class OverrideMessageContentToolResultContentBlock(TypedDict, total=False):


OverrideMessageContent: TypeAlias = Union[
OverrideMessageContentTextContentBlockSchema,
OverrideMessageContentTextContentBlock,
OverrideMessageContentImageBase64ContentBlock,
OverrideMessageContentToolCallContentBlock,
OverrideMessageContentToolResultContentBlock,
Expand Down
Loading