Spaces:
Sleeping
Sleeping
lukestanley
commited on
Commit
•
f84c1a6
1
Parent(s):
327982a
Removed unused lines
Browse files
utils.py
CHANGED
@@ -8,11 +8,12 @@ from llama_cpp import json_schema_to_gbnf # Only used directly to convert the J
|
|
8 |
|
9 |
def llm_streaming(prompt:str, pydantic_model_class, return_pydantic_object=False) -> Union[str, Dict[str, Any]]:
|
10 |
schema = pydantic_model_class.model_json_schema()
|
|
|
|
|
11 |
if "example" in schema:
|
12 |
del schema["example"]
|
|
|
13 |
json_schema = json.dumps(schema)
|
14 |
-
#example = Actor.model_config['json_schema_extra']['example']
|
15 |
-
#grammar = llama_cpp.LlamaGrammar.from_json_schema(json_schema,verbose=False)
|
16 |
grammar = json_schema_to_gbnf(json_schema)
|
17 |
|
18 |
payload = {
|
|
|
8 |
|
9 |
def llm_streaming(prompt:str, pydantic_model_class, return_pydantic_object=False) -> Union[str, Dict[str, Any]]:
|
10 |
schema = pydantic_model_class.model_json_schema()
|
11 |
+
|
12 |
+
# Optional example field from schema, is not needed for the grammar generation
|
13 |
if "example" in schema:
|
14 |
del schema["example"]
|
15 |
+
|
16 |
json_schema = json.dumps(schema)
|
|
|
|
|
17 |
grammar = json_schema_to_gbnf(json_schema)
|
18 |
|
19 |
payload = {
|