-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy path102_example.py
More file actions
38 lines (32 loc) · 1.23 KB
/
102_example.py
File metadata and controls
38 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# pytest: skip, huggingface, e2e
# SKIP REASON: Requires user input; tests same functionality as 101_example.py.
from stembolts_intrinsic import (
async_stembolt_failure_analysis,
stembolt_failure_analysis,
)
from mellea.backends.cache import SimpleLRUCache
from mellea.backends.huggingface import LocalHFBackend
from mellea.stdlib.context import ChatContext
if __name__ == "__main__":
backend = LocalHFBackend(
model_id="ibm-granite/granite-3.3-2b-instruct", cache=SimpleLRUCache(5)
)
welcome_msg = (
"== Welcome to the Self-Sealing Stembolt Part Diagnostic System. =="
)
print("=" * len(welcome_msg))
print("=" * len(welcome_msg))
print(welcome_msg)
print("=" * len(welcome_msg))
print("=" * len(welcome_msg))
mechanics_notes = None
while True:
if mechanics_notes is None:
mechanics_notes = "Oil seepage when stembolt is oriented diagonally, even when oil pin is tightened"
print(f"Mechanic: {mechanics_notes}")
else:
mechanics_notes = input("Mechanic: ")
result, ctx = stembolt_failure_analysis(
notes=mechanics_notes, ctx=ChatContext(), backend=backend
)
print(f"Assistant: {result}")