File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
examples/offline_inference Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 1919print (outputs [0 ].outputs [0 ].text )
2020
2121# Guided decoding by Regex
22- guided_decoding_params = GuidedDecodingParams (regex = "\w+@\w+\.com\n " )
22+ guided_decoding_params = GuidedDecodingParams (regex = r "\w+@\w+\.com\n" )
2323sampling_params = SamplingParams (guided_decoding = guided_decoding_params ,
2424 stop = ["\n " ])
2525prompt = ("Generate an email address for Alan Turing, who works in Enigma."
@@ -57,17 +57,12 @@ class CarDescription(BaseModel):
5757
5858# Guided decoding by Grammar
5959simplified_sql_grammar = """
60- ?start: select_statement
61-
62- ?select_statement: "SELECT " column_list " FROM " table_name
63-
64- ?column_list: column_name ("," column_name)*
65-
66- ?table_name: identifier
67-
68- ?column_name: identifier
69-
70- ?identifier: /[a-zA-Z_][a-zA-Z0-9_]*/
60+ root ::= select_statement
61+ select_statement ::= "SELECT " column " from " table " where " condition
62+ column ::= "col_1 " | "col_2 "
63+ table ::= "table_1 " | "table_2 "
64+ condition ::= column "= " number
65+ number ::= "1 " | "2 "
7166"""
7267guided_decoding_params = GuidedDecodingParams (grammar = simplified_sql_grammar )
7368sampling_params = SamplingParams (guided_decoding = guided_decoding_params )
You can’t perform that action at this time.
0 commit comments