Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/6939b23e-87cc-8001-bdd9-9546d1143ce9
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Below is an outline (not a full program, but a reliable scaffold). === <syntaxhighlight>import json import csv from openai import OpenAI client = OpenAI() === Load taxonomy and reference tables === taxonomy = json.load(open("taxonomy.json")) ref_tables = { "materials": json.load(open("materials.json")), "biology": json.load(open("biology.json")), "deps": json.load(open("dependencies.json")), } === Main output storage === output = [] COLUMN_BLOCKS = [ ["tech_name","description","category","sub_category","era"], ["natural_resource_prerequisites", "natural_resource_prerequisites_explanations", "biological_prerequisites", "biological_prerequisites_explanations", "geographical_prerequisites", "geographical_prerequisites_explanations"], ["previous_tech_prerequisites","related_or_parallel_technologies", "enabler_results","enabler_description"], ["primary_energy_source","tools_used","weapons_enabled", "transport_required"], ["education_level_and_type","social_complexity", "population_density","population_density_explanations"], ["ecological_impact","sustainability", "productivity_multiplier","innovation_rate", "innovation_rate_explanations"], ["tech_spread_rate","tech_spread_rate_explanations", "stability_dependency","interconnectivity_index", "diffusion_method","notes"] ] def generate_block(row_meta, context, block_columns): # Construct the prompt using the modelโs strengths: # - schema # - definitions # - reference tables # - previous outputs for this row # - global constraints prompt = build_prompt(row_meta, context, block_columns) response = client.chat.completions.create( model="your-model", messages=[{"role":"user","content":prompt}], temperature=0 ) return parse_model_output(response, block_columns) for row in taxonomy: row_output = {} row_meta = extract_row_metadata(row) context = { "completed_rows": output, "ref_tables": ref_tables } for block in COLUMN_BLOCKS: partial = generate_block(row_meta, context, block) row_output.update(partial) output.append(row_output) === Save final output === with open("full_table.csv","w",newline="") as f: writer = csv.DictWriter(f, fieldnames=sum(COLUMN_BLOCKS,[])) writer.writeheader() writer.writerows(output) </syntaxhighlight> This gives you full control and avoids any model refusal.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)