Skip to content

Commit 6edfe71

Browse files
committed
Draft
1 parent f118c9f commit 6edfe71

File tree

4 files changed

+172
-93
lines changed

4 files changed

+172
-93
lines changed

outlines_example.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Box(BaseModel):
88
width: int
99
height: int
1010
depth: int
11-
units: str
11+
units: int
1212

1313

1414
def transformers_example():
@@ -22,8 +22,8 @@ def transformers_example():
2222
chat_template = '{% for message in messages %}{{ message.role }}: {{ message.content }}{% endfor %}'
2323
hf_tokenizer.chat_template = chat_template
2424

25-
model = OutlinesModel.transformers(hf_model, hf_tokenizer, settings=ModelSettings(max_new_tokens=100))
26-
agent = Agent(model, output_type=NativeOutput([Box]))
25+
model = OutlinesModel.from_transformers(hf_model, hf_tokenizer, settings=ModelSettings(max_new_tokens=100))
26+
agent = Agent(model, output_type=[Box])
2727

2828
response = agent.run_sync('Give me the dimensions of a box')
2929
print("response.output: ", response.output)
@@ -47,7 +47,7 @@ def llama_cpp_example():
4747
n_ctx=2048, # 2K context window
4848
)
4949

50-
model = OutlinesModel.llama_cpp(llama_model)
50+
model = OutlinesModel.from_Somllama_cpp(llama_model)
5151
agent = Agent(model, output_type=NativeOutput([Box]))
5252

5353
response = agent.run_sync('Give me the dimensions of a box')
@@ -62,6 +62,6 @@ def llama_cpp_example():
6262

6363

6464
if __name__ == "__main__":
65-
#transformers_example()
66-
llama_cpp_example()
65+
transformers_example()
66+
#llama_cpp_example()
6767
#existing()

0 commit comments

Comments
 (0)