Skip to content

Commit

Permalink
fix: cache age type fix (#11)
Browse files Browse the repository at this point in the history
* docs: Readme update

* fix: Updates on types and type checks
1. Exposed the type RetrySettings as the attribute of portkey
2. Updated the cache-age check in the providerOptions part as it is inheriting it from constructs.
3. Updated the readme docs with new changelog.

* feat: version upgrade - 0.1.48

* feat: Exposed the response types of the chat and text completions w/without streaming
  • Loading branch information
noble-varghese authored Sep 14, 2023
1 parent 4b8b8a9 commit 9f9f12d
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 17 deletions.
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,33 @@ pip install portkey-ai


<br></br>
# Changelog
### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.1.45](https://github.com/Portkey-AI/portkey-python-sdk/compare/v0.1.44...v0.1.45)

> 12 September 2023
- feat: Add support for azure models [`#9`](https://github.com/Portkey-AI/portkey-python-sdk/pull/9)
- docs: Added examples for azure-openai fallback and loadbalance [`#8`](https://github.com/Portkey-AI/portkey-python-sdk/pull/8)
- chore: Updating the documentation [`#7`](https://github.com/Portkey-AI/portkey-python-sdk/pull/7)
- chore: Updating the documentation [`#6`](https://github.com/Portkey-AI/portkey-python-sdk/pull/6)
- chore: Adding an example for ab-testing and loadbalance [`#5`](https://github.com/Portkey-AI/portkey-python-sdk/pull/5)

#### v0.1.44

> 11 September 2023
- feat: added changie to generate changelogs [`#4`](https://github.com/Portkey-AI/portkey-python-sdk/pull/4)
- feat: version upgrade - 0.1.44 [`#3`](https://github.com/Portkey-AI/portkey-python-sdk/pull/3)
- feat: Workflow update [`cb80617`](https://github.com/Portkey-AI/portkey-python-sdk/commit/cb806173049d2a1f690935320e5ad4738910a452)
- fea: Initial Commit [`2c3631a`](https://github.com/Portkey-AI/portkey-python-sdk/commit/2c3631ac65ff58158695e84881993460fd27cb82)
- feat: adding the streaming capability into rubeus sdk [`f06e23b`](https://github.com/Portkey-AI/portkey-python-sdk/commit/f06e23bfa676995d578f64eff3401db917660742)

<!-- auto-changelog-above -->

We are excited to announce the **stable release** of the all-new **Portkey Python SDK**, version 0.1.44! This SDK makes it easier than ever to add production capabilities to your existing LLM systems with one line of change to your code.

Expand All @@ -82,13 +108,6 @@ We are excited to announce the **stable release** of the all-new **Portkey Pytho

- **Community Support**: [Join our growing community](https://discord.gg/QHJ3RgcvKT) of practitioners putting LLMs in production. Share ideas, resolve doubts, and collaborate on projects.

### Feedback and Contributions

We welcome your feedback and contributions! Feel free to report issues, suggest enhancements, or submit pull requests on our [GitHub repository](https://github.com/Portkey-AI/portkey-python-sdk).

Thank you for your support and enthusiasm for the Portkey Python SDK. We look forward to seeing the amazing projects you will build with it!

Happy coding!

- The Portkey Team

10 changes: 10 additions & 0 deletions portkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
Completions,
Params,
Config,
RetrySettings,
ChatCompletion,
ChatCompletionChunk,
TextCompletion,
TextCompletionChunk,
)
from portkey.version import VERSION

Expand All @@ -35,6 +40,11 @@
"ChatCompletions",
"Completions",
"Params",
"RetrySettings",
"ChatCompletion",
"ChatCompletionChunk",
"TextCompletion",
"TextCompletionChunk",
"Config",
"api_key",
"base_url",
Expand Down
10 changes: 10 additions & 0 deletions portkey/api_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
PortkeyResponse,
Params,
Config,
RetrySettings,
ChatCompletion,
ChatCompletionChunk,
TextCompletion,
TextCompletionChunk,
)

from portkey.version import VERSION
Expand All @@ -31,4 +36,9 @@
"Completions",
"Params",
"Config",
"RetrySettings",
"ChatCompletion",
"ChatCompletionChunk",
"TextCompletion",
"TextCompletionChunk",
]
16 changes: 8 additions & 8 deletions portkey/api_resources/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ApiType(str, Enum, metaclass=MetaEnum):
CHAT_COMPLETION = "chat_completions"


ModesLiteral = Literal["fallback", "loadbalance", "single", "proxy"]
ModesLiteral = Literal["fallback", "ab_test", "single", "proxy"]


class PortkeyApiPaths(Enum):
Expand Down Expand Up @@ -200,13 +200,6 @@ class Constructs(BaseModel):


class LLMOptions(Constructs, ConversationInput, ModelParams):
@validator("cache_age", always=True)
@classmethod
def parse_cache_age(cls, cache_age):
if cache_age is not None:
cache_age = f"max-age={cache_age}"
return cache_age

@validator("api_key", "virtual_key", always=False)
@classmethod
def parse_api_key(cls, api_key, values):
Expand All @@ -219,6 +212,13 @@ def parse_api_key(cls, api_key, values):

class ProviderOptions(Constructs):
override_params: Optional[OverrideParams] = None

@validator("cache_age", always=True)
@classmethod
def parse_cache_age(cls, cache_age):
if cache_age is not None:
cache_age = f"max-age={cache_age}"
return cache_age


class RequestConfig(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion portkey/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.1.47"
VERSION = "0.1.48"

0 comments on commit 9f9f12d

Please sign in to comment.