Skip to content

Commit 34fafc0

Browse files
committed
0.3.6 - update models and runtime dependencies
1 parent 66e56f5 commit 34fafc0

File tree

5 files changed

+2202
-1921
lines changed

5 files changed

+2202
-1921
lines changed

bpm_ai_inference/llm/llama_cpp/llama_chat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def __init__(
4545
model: str = DEFAULT_MODEL,
4646
filename: str = DEFAULT_QUANT_BALANCED,
4747
temperature: float = DEFAULT_TEMPERATURE,
48+
grammar: str = None,
4849
max_retries: int = DEFAULT_MAX_RETRIES,
4950
force_offline: bool = (os.getenv(FORCE_OFFLINE_FLAG, "false").lower() == "true")
5051
):
@@ -56,6 +57,7 @@ def __init__(
5657
max_retries=max_retries,
5758
retryable_exceptions=[]
5859
)
60+
self.grammar = grammar
5961
n_ctx = 4096
6062
if force_offline:
6163
model_file = find_file(hf_home() + "hub/models--" + model.replace("/", "--"), filename)
@@ -135,6 +137,8 @@ async def _run_completion(
135137
prefix = "<tool_call>"
136138
stop = ["</tool_call>"]
137139

140+
grammar = self.grammar if not grammar and self.grammar else grammar
141+
138142
Tracing.tracers().start_llm_trace(self, messages, current_try, tools or ({"output_schema": output_schema} if output_schema else None))
139143
completion: CreateChatCompletionResponse = self.llm.create_chat_completion(
140144
messages=messages,

bpm_ai_inference/token_classification/gliner_token_classifier.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
logger = logging.getLogger(__name__)
1515

1616

17+
DEFAULT_MODEL = "numind/NuNER_Zero-span"
18+
DEFAULT_MODEL_2 = "urchade/gliner_large-v2.1"
19+
1720
@cachable()
1821
class GlinerTokenClassifier(ZeroShotTokenClassifier):
1922
"""
@@ -22,7 +25,7 @@ class GlinerTokenClassifier(ZeroShotTokenClassifier):
2225
To use, you should have the ``gliner`` python package installed.
2326
"""
2427

25-
def __init__(self, model: str = "urchade/gliner_large-v2.1"):
28+
def __init__(self, model: str = DEFAULT_MODEL):
2629
self.model = GLiNER.from_pretrained(model)
2730

2831
@override

0 commit comments

Comments
 (0)