trump-era goes to hollywood
the swarm-coder is tested and working. i'm working on this for months and have tried a lot of improvements while learning by doing. implementing memories and web-search for a LLM is crucial.
beyond this i'm experimenting with ML BoW models creating a pool of classifiers (vectorizers) and managing these.
the magic code results in fantastic and wonder improvements and can make a land to land of milk and honey.
I'm using these LLM:
"OLLAMA_API_MODEL = 'deepseek-coder:33b-instruct-fp16'
OLLAMA_HELPER_API_MODEL = 'phi3:14b-medium-128k-instruct-q8_0'
OLLAMA_API_URL = 'http://localhost:11434/api'
coder_LLM = 'dolphincoder:15b-starcoder2-fp16'
coder_LLM_2 = 'yi-coder:9b-chat-fp16'"
and this objective:
"
Create a Python program that consists of a single class named 'TemperatureConverter' in a file named 'temperature_converter.py'. The class should have the following methods:
- celsius_to_fahrenheit(self, celsius: float) -> float: Converts Celsius temperature to Fahrenheit.
- fahrenheit_to_celsius(self, fahrenheit: float) -> float: Converts Fahrenheit temperature to Celsius.
Create a separate 'main.py' file that imports the 'TemperatureConverter' class, takes user input for the temperature value and the unit, converts the temperature to the other unit, and then prints the result. Don't make any new folders. Use only the current direcory to store files.
Use the python module argparse 'import argparse' to parse command-line arguments and pass them to the 'user_input()' function:
'parser = argparse.ArgumentParser()
parser.add_argument('--value', type=float, required=True)
parser.add_argument('--convertto', type=str, required=True, choices=['C', 'F'])'
Execute 'python main.py --value 16 --convertto F'
Ensure proper error handling and edge case testing."
to create main.py and temperature_converter.py (fully automated done through the LLMs and the swarm-coder script v22092024)
main.py (original file- needs minimal adaptation- under construction):
{"code": "from temperature_converter import TemperatureConverter\nimport argparse\n\n# Create the parser\nparser = argparse.ArgumentParser()\nparser.add_argument('--value', type=float, required=True)\nparser.add_argument('--convertto', choices=['F', 'C'], required=True)\nargs = parser.parse_args()\n\ntc = TemperatureConverter(args.value)\nif args.convertto == 'F':\n print(tc.fahrenheit_to_celsius())\nelif args.convertto == 'C':\n print(tc.celsius_to_fahrenheit())"}
import argparse
# Create the parser
parser = argparse.ArgumentParser()
parser.add_argument("--value", type=float)
parser.add_argument("--convertto")
args = parser.parse_args()
tc = TemperatureConverter(args.value)
if args.convertto == "celsius":
print(tc.fahrenheit_to_celsius())
elif args.convertto == "fahrenheit":
print(tc.celsius_to_fahrenheit())
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--value', type=float, required=True)
parser.add_argument('--convertto', choices=['F', 'C'], required=True)
args = parser.parse_args()
temperature = args.value
if args.convertto == 'F':
print(temperature * 9/5 + 32)
elif args.convertto == 'C':
print((temperature - 32) * 5/9)
and temperature_converter.py:
class TemperatureConverter:
def celsius_to_fahrenheit(self, celsius):
return (celsius * 9/5) + 32
def fahrenheit_to_celsius(self, fahrenheit):
return (fahrenheit - 32) * 5/9
this is the adapted main-adapt.py (a codechunk is deleted- the script has created the code but while the refractor process the code-elements where not threated)
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--value', type=float, required=True)
parser.add_argument('--convertto', choices=['F', 'C'], required=True)
args = parser.parse_args()
temperature = args.value
if args.convertto == 'F':
print(temperature * 9/5 + 32)
elif args.convertto == 'C':
print((temperature - 32) * 5/9)
- ·
- · Dusko
- · Technology
- · dichipcoin
- · 3184 views