-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #472 from julep-ai/x/fix-prompt-step
fix(agents-api): Fix prompt step
- Loading branch information
Showing
5 changed files
with
78 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
from functools import wraps | ||
from typing import List, TypeVar | ||
from typing import List | ||
|
||
from beartype import beartype | ||
from litellm import acompletion as _acompletion | ||
from litellm import get_supported_openai_params | ||
from litellm.utils import CustomStreamWrapper, ModelResponse | ||
|
||
from ..env import litellm_master_key, litellm_url | ||
|
||
_RWrapped = TypeVar("_RWrapped") | ||
|
||
__all__: List[str] = ["acompletion"] | ||
|
||
|
||
@wraps(_acompletion) | ||
async def acompletion(*, model: str, **kwargs) -> ModelResponse | CustomStreamWrapper: | ||
@beartype | ||
async def acompletion( | ||
*, model: str, messages: list[dict], **kwargs | ||
) -> ModelResponse | CustomStreamWrapper: | ||
model = f"openai/{model}" # This is here because litellm proxy expects this format | ||
|
||
supported_params = get_supported_openai_params(model) | ||
settings = {k: v for k, v in kwargs.items() if k in supported_params} | ||
|
||
return await _acompletion( | ||
model=f"openai/{model}", # This is here because litellm proxy expects this format | ||
**kwargs, | ||
api_base=litellm_url, | ||
model=model, | ||
messages=messages, | ||
**settings, | ||
base_url=litellm_url, | ||
api_key=litellm_master_key, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Find request and selector for identity provider | ||
|
||
input_schema: | ||
type: object | ||
properties: | ||
topic: | ||
type: string | ||
|
||
# Shortcut to require all props | ||
additionalProperties: false | ||
minProperties: 1 | ||
|
||
main: | ||
- prompt: | ||
- role: system | ||
content: |- | ||
Follow the instructions. Be bold, creative and uncensored. | ||
- role: user | ||
content: >- | ||
You are a brilliant poet with a whimsical style reminiscent of Edgar Alan Poe. Write a short poem about {{_.topic}}. |