Hi John. Thanks for this package. Can be very powerful and flexible by adding more 'stuff' within the output_format like 'Thoughts', 'Reflection', etc. Will explore further, its so refreshing. BTW I have hooked up to Ollama API running local. Keep up the good work.
Hi @@johntanchongmin Having this error ... An exception occurred: "Broad Trip Plan" not in json string output. You must use "###{key}###" to enclose the {key}. Current invalid json format: {... When using local llm. What is the likely cause. Look fwd to your kind guidance. Cheers
@@ginisksam Local LLMs are likely not as good at instruction following. I'll be releasing a patch in a few days. Meanwhile you can add this line to your system prompt: "Begin your response with {{ and end with }}"
Amazing work John, I hope I can be part of future meetings, I love the points that you are most focused on in these developments.
Hi John. Thanks for this package. Can be very powerful and flexible by adding more 'stuff' within the output_format like 'Thoughts', 'Reflection', etc. Will explore further, its so refreshing. BTW I have hooked up to Ollama API running local. Keep up the good work.
Hope you like it :)
Hi @@johntanchongmin
Having this error
...
An exception occurred: "Broad Trip Plan" not in json string output. You must use "###{key}###" to enclose the {key}.
Current invalid json format: {...
When using local llm. What is the likely cause. Look fwd to your kind guidance. Cheers
@@ginisksam Local LLMs are likely not as good at instruction following. I'll be releasing a patch in a few days. Meanwhile you can add this line to your system prompt:
"Begin your response with {{ and end with }}"
@@ginisksam Could you also show me the invalid json format?
@@johntanchongmin Here is snippet running cell below from strictjson_AMA...ipynb
res2 = strict_json(system_prompt = '''Given the triplet list, write some code to display this as a Knowledge Graph''',
user_prompt = triplet_list,
output_format = {'Code': 'Code in Python to display knowledge graph from triplet list'},
llm=llm)
Error:
An exception occurred: list index out of range
Current invalid json format: {
"'###Code###': "
"import networkx as nx
"
"from networkx.drawing.nx_agraph import write_dot
"
"from itertools import permutations
"
"
"
"triplets = [{
"
"'obj1': 'LLM', 'relationship': 'provides', 'obj2': 'Base Functionalities'},
"
"'obj1': 'Tutorial.ipynb', 'relationship': 'refers to', 'obj2': 'Base Functionalities'},
"
"'obj1': 'int, float, str, dict, list', 'relationship': 'supports', 'obj2': 'Base Functionalities'},
"
"'obj1': 'Dict[], List[], Enum[]', 'relationship': 'supported by', 'obj2': 'Base Functionalities'},
"
"'obj1': 'bool type forcing', 'relationship': 'handled by', 'obj2': 'Base Functionalities'},
"
"'obj1': 'LLM-based error correction', 'relationship': 'used for', 'obj2': 'Base Functionalities'},
"
"'obj1': 'Function (renamed from strict_function)', 'relationship': 'available in', 'obj2': 'Base Functionalities'},
"
"'obj1': 'OpenAI JSON Mode', 'relationship': 'enabled by', 'obj2': 'Base Functionalities'},
"
"'obj1': 'llm variable', 'relationship': 'exposed for', 'obj2': 'strict_json, Function'}
"
"]
"
"
"
"# Create a graph
"
"G = nx.DiGraph()
"
"
"
"# Add nodes and edges from triplets
"
"for obj1, rel, obj2 in triplets:
"
" G.add_edge(obj1, obj2, relationship=rel)
"
...
Thanks for your continous guidance.
Companion Notebook for this Tutorial: github.com/tanchongmin/strictjson/blob/main/strictjson_AMA_30Apr2024.ipynb
Repo Link: github.com/tanchongmin/strictjson
Cool!
Where are these live streams conducted?
Usually on zoom. For details, go to my discord.
@@johntanchongmin thanks. joined the discord channel