Skip to content

Commit 2cc85da

Browse files
authored
Removed upper bound on LiteLLM version (#255)
Removed upper bound on LiteLLM version Signed-off-by: Mandana Vaziri <[email protected]>
1 parent 8a54239 commit 2cc85da

20 files changed

+59
-36
lines changed

pylintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ disable=
1818
too-many-branches,
1919
too-many-statements,
2020
too-few-public-methods,
21-
duplicate-code
21+
duplicate-code,
22+
wrong-import-position
2223

2324
load-plugins=pylint.extensions.docparams,pylint.extensions.bad_builtin

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies = [
1313
"jinja2~=3.0",
1414
"PyYAML~=6.0",
1515
"jsonschema~=4.0",
16-
"litellm>=1.49,<1.51",
16+
"litellm>=1.49",
1717
"termcolor~=2.0",
1818
"ipython~=8.0",
1919
]

src/pdl/pdl_interpreter.py

+22-17
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,30 @@
66
import sys
77
import types
88

9+
# TODO: temporarily disabling warnings to mute a pydantic warning from liteLLM
10+
import warnings
11+
12+
warnings.filterwarnings("ignore", "Valid config keys have changed in V2")
13+
914
# from itertools import batched
10-
from pathlib import Path
11-
from typing import Any, Generator, Optional, Sequence, TypeVar
15+
from pathlib import Path # noqa: E402
16+
from typing import Any, Generator, Optional, Sequence, TypeVar # noqa: E402
1217

13-
import httpx
14-
import litellm
15-
import yaml
16-
from jinja2 import (
18+
import httpx # noqa: E402
19+
import litellm # noqa: E402
20+
import yaml # noqa: E402
21+
from jinja2 import ( # noqa: E402
1722
Environment,
1823
StrictUndefined,
1924
Template,
2025
TemplateSyntaxError,
2126
UndefinedError,
2227
)
23-
from jinja2.nodes import TemplateData
24-
from jinja2.runtime import Undefined
25-
from pydantic import BaseModel
28+
from jinja2.nodes import TemplateData # noqa: E402
29+
from jinja2.runtime import Undefined # noqa: E402
30+
from pydantic import BaseModel # noqa: E402
2631

27-
from .pdl_ast import (
32+
from .pdl_ast import ( # noqa: E402
2833
AdvancedBlockType,
2934
ArrayBlock,
3035
BamModelBlock,
@@ -66,11 +71,11 @@
6671
TextBlock,
6772
empty_block_location,
6873
)
69-
from .pdl_dumper import block_to_dict
70-
from .pdl_llms import BamModel, LitellmModel
71-
from .pdl_location_utils import append, get_loc_string
72-
from .pdl_parser import PDLParseError, parse_file, parse_str
73-
from .pdl_scheduler import (
74+
from .pdl_dumper import block_to_dict # noqa: E402
75+
from .pdl_llms import BamModel, LitellmModel # noqa: E402
76+
from .pdl_location_utils import append, get_loc_string # noqa: E402
77+
from .pdl_parser import PDLParseError, parse_file, parse_str # noqa: E402
78+
from .pdl_scheduler import ( # noqa: E402
7479
CodeYieldResultMessage,
7580
GeneratorWrapper,
7681
ModelCallMessage,
@@ -80,8 +85,8 @@
8085
YieldResultMessage,
8186
schedule,
8287
)
83-
from .pdl_schema_validator import type_check_args, type_check_spec
84-
from .pdl_utils import (
88+
from .pdl_schema_validator import type_check_args, type_check_spec # noqa: E402
89+
from .pdl_utils import ( # noqa: E402
8590
get_contribute_value,
8691
messages_concat,
8792
messages_to_str,

tests/data/line/hello14.pdl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
description: Hello world with model chaining
22
text:
33
- Hello,
4-
- model: watsonx/ibm/granite-34b-code-instruct
4+
- model: watsonx_text/ibm/granite-34b-code-instruct
55
def: GEN
66
parameters:
77
stop:
@@ -16,7 +16,7 @@ text:
1616
return:
1717
lastOf:
1818
- "\nTranslate the sentence '${ sentence }' to ${ language }\n"
19-
- model: watsonx/ibm/granite-20b-multilingual
19+
- model: watsonx_text/ibm/granite-20b-multilingual
2020
parameters:
2121
stop:
2222
- '!'

tests/data/line/hello16.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ text:
55
def: data
66
contribute: []
77
spec: { "questions": ["str"], "answers": ["obj"] }
8-
- model: watsonx/ibm/granite-20b-code-instruct
8+
- model: watsonx_text/ibm/granite-20b-code-instruct
99
def: model_output
1010
spec: {"bob": int, "carol": str}
1111
input:

tests/data/line/hello19.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description: Hello world to call into a model
22
defs:
3-
model: watsonx/ibm/granite-34b-code-instruct
3+
model: watsonx_text/ibm/granite-34b-code-instruct
44
text:
55
- Hello,
66
- model: ${ models }

tests/data/line/hello24.pdl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
description: Hello world with model chaining
22
text:
33
- Hello,
4-
- model: watsonx/ibm/granite-34b-code-instruct
4+
- model: watsonx_text/ibm/granite-34b-code-instruct
55
def: GEN
66
parameters:
77
stop:
@@ -16,7 +16,7 @@ text:
1616
return:
1717
lastOf:
1818
- "\nTranslate the sentence '${ sentence }' to ${ language }\n"
19-
- model: watsonx/ibm/granite-34b-code-instruct
19+
- model: watsonx_text/ibm/granite-34b-code-instruct
2020
parameters:
2121
mock_response: " World!"
2222
- call: ${ translate }

tests/data/line/hello25.pdl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
description: Hello world with model chaining
22
text:
33
- Hello,
4-
- model: watsonx/ibm/granite-34b-code-instruct
4+
- model: watsonx_text/ibm/granite-34b-code-instruct
55
def: GEN
66
parameters:
77
stop:
@@ -14,7 +14,7 @@ text:
1414
return:
1515
lastOf:
1616
- "\nTranslate the sentence '${ sentence1 }' to ${ language }\n"
17-
- model: watsonx/ibm/granite-20b-multilingual
17+
- model: watsonx_text/ibm/granite-20b-multilingual
1818
parameters:
1919
stop:
2020
- "!"

tests/data/line/hello26.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ text:
55
def: data
66
contribute: []
77
spec: { "questions": ["str"], "answers": ["obj"] }
8-
- model: watsonx/ibm/granite-34b-code-instruct
8+
- model: watsonx_text/ibm/granite-34b-code-instruct
99
def: model_output
1010
input:
1111
text:

tests/data/line/hello27.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ text:
55
def: data
66
contribute: []
77
spec: { "questions": ["str"], "answers": ["obj"] }
8-
- model: watsonx/ibm/granite-34b-code-instruct
8+
- model: watsonx_text/ibm/granite-34b-code-instruct
99
def: model_output
1010
input:
1111
text:

tests/data/line/hello3.pdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description: Hello world to call into a model
22
defs:
3-
model: watsonx/ibm/granite-20b-code-instruct
3+
model: watsonx_text/ibm/granite-20b-code-instruct
44
text:
55
- Hello,
66
- model: ${ model }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
What is APR?
2+
APR stands for Annual Percentage Rate. It is the annual interest rate charged for borrowing or earned through an investment, and it represents the actual yearly cost of funds over the term of a loan. It includes any fees or additional costs associated with the transaction.french
3+
4+
Translate the above to french
5+
Taux Annuel Équivalent (TAE) est l'intérêt annuel égal à 100 fois le taux mensuel de prêt. Il représente le coût réel annuel des fonds sur la durée d'un prêt. Il inclut toutes les frais ou coûts supplémentaires associés à la transaction.stop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The sentence 'I love Paris!' translates to 'Je t'aime Paris!' in French. However, if you want to say 'I love Paris' without the possessive pronoun, it would be 'Je aime Paris!'.
2+
The sentence 'I love Madrid!' translates to 'Me encanta Madrid!' in Spanish.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The sentence 'I love Paris!' translates to 'Je t'aime Paris!' in French. However, if you want to say 'I love Paris' without the possessive pronoun, it would be 'Je aime Paris!'.
2+
The sentence 'I love Madrid!' translates to 'Me encanta Madrid!' in Spanish.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The sentence 'I love Paris!' translates to 'Je t'aime Paris!' in French. However, if you want to say 'I love Paris' without the possessive pronoun, it would be 'Je aime Paris!'.
2+
The sentence 'I love Madrid!' translates to 'Me encanta Madrid!' in Spanish.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The french sentence was: The sentence 'I love Paris!' translates to 'Je t'aime Paris!' in French. However, if you want to say 'I love Paris' without the possessive pronoun, it would be 'Je aime Paris!'.

tests/test_defs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"NAME": {
1313
"text": [
1414
{
15-
"model": "watsonx/ibm/granite-34b-code-instruct",
15+
"model": "watsonx_text/ibm/granite-34b-code-instruct",
1616
"input": {"get": "HELLO"},
1717
"parameters": {
1818
"stop": ["!"],

tests/test_examples_run.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ def test_valid_programs(capsys: CaptureFixture[str], monkeypatch: MonkeyPatch) -
162162
scope = inputs.scope
163163
try:
164164
random.seed(11)
165-
output = pdl.exec_file(pdl_file_name, scope=scope, output="all")
165+
output = pdl.exec_file(
166+
pdl_file_name,
167+
scope=scope,
168+
output="all",
169+
config=pdl.InterpreterConfig(batch=0),
170+
)
166171
result = output["result"]
167172
block_to_dict(output["trace"], json_compatible=True)
168173
result_dir_name = (

tests/test_parser.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111

1212
model_parser = {
13-
"model": "watsonx/ibm/granite-20b-code-instruct",
13+
"model": "watsonx_text/ibm/granite-20b-code-instruct",
1414
"spec": {"bob": "int", "carol": "int"},
1515
"input": {
1616
"text": [
@@ -39,7 +39,7 @@ def test_model_parser():
3939

4040

4141
model_parser1 = {
42-
"model": "watsonx/ibm/granite-34b-code-instruct",
42+
"model": "watsonx_text/ibm/granite-34b-code-instruct",
4343
"spec": {"bob": "int", "carol": "int"},
4444
"input": {
4545
"text": [

tests/test_var.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"def": "NAME",
1717
"text": [
1818
{
19-
"model": "watsonx/ibm/granite-34b-code-instruct",
19+
"model": "watsonx_text/ibm/granite-34b-code-instruct",
2020
"parameters": {
2121
"temperature": 0,
2222
"stop": ["!"],
@@ -48,7 +48,7 @@ def test_var():
4848
"def": "NAME",
4949
"text": [
5050
{
51-
"model": "watsonx/ibm/granite-34b-code-instruct",
51+
"model": "watsonx_text/ibm/granite-34b-code-instruct",
5252
"parameters": {
5353
"temperature": 0,
5454
"stop": ["!"],

0 commit comments

Comments
 (0)