MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / load_in_context_examples

Function load_in_context_examples

byod/api/app/utils.py:11–28  ·  view source on GitHub ↗

Setup in context examples dict

()

Source from the content-addressed store, hash-verified

9
10IN_CONTEXT_EXAMPLES_DICT = {}
11def load_in_context_examples():
12 """
13 Setup in context examples dict
14 """
15 global IN_CONTEXT_EXAMPLES_DICT
16
17 if not DB_MANAGED_METADATA:
18 with open("app/models/json/in_context_examples.json", "r") as f:
19 IN_CONTEXT_EXAMPLES_DICT = json.load(f)
20 return
21
22 try:
23 in_context_examples = InContextExamples.query.all()
24 except Exception as e:
25 print(e)
26 in_context_examples = []
27 for in_context_example in in_context_examples:
28 IN_CONTEXT_EXAMPLES_DICT[in_context_example.mode] = in_context_example.examples
29
30
31def get_few_shot_messages(mode: str = "text_to_sql") -> List[Dict]:

Callers 1

create_appFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected