986 B
986 B
markup, title, description, import
| markup | title | description | import | ||||
|---|---|---|---|---|---|---|---|
| occlusion | llm tool_calls offline | Parse OpenAI-shaped tool_calls into a list; no network. |
|
main
raw = "{"choices":[{"finish_reason":"tool_calls","message":{"role":"assistant","content":null,"tool_calls":[{"id":"call_1","type":"function","function":{"name":"lookup","arguments":"{\"q\":\"marqdo\"}"}}]}}]}"
data = > json.parse text=raw
tc = > openai.tool_calls_from data=data
n = > len value=tc
print text=
nfirst = 1) print text=id) print text=type) fn = function) print text=name)
empty_data = > json.parse text={"choices":[{"message":{"role":"assistant","content":"hi"}}]}
empty = > openai.tool_calls_from data=empty_data
en = > len value=empty
print text=
en