Home Artists Posts Import Register

Downloads

Content

Youtube video for this project: https://youtu.be/21yDy0M3Uik

In this Auto Coder we can use simple commands to generate multiple alternative files in parallel and select from multiple custom prompts for each turn of generation. This Auto Coder works with Anthropic's Claude 3 Opus model

Auto Streamer: https://www.autostreamer.live/

Search 200+ echohive videos and code download links:https://www.echohive.live/

CodeHive 900+ GPT python chat apps: https://www.codehive.app/

Chat with us on Discord:

https://discord.gg/PPxTP3Cs3G

Follow on twitter(X) : https://twitter.com/hive_echo

Files

Comments

Alexander Williams

Everything you do is amazing and inspirational. I've built a few things on my own, but one that I do have trouble with is the ability to create a codebase. It would be nice for some outputs to be a js, css, and html file for instance. But the output I've only ever managed to get was one file, or a few bad files. Here's a script that I'd attempted with this effort: PS (some of the steps are repetitive and unnecessary, but I gave up on this one a while back, so its outdated in its functionality) import os import anthropic # Get the API keys from the environment variables anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY") if anthropic_api_key is None: raise ValueError("ANTHROPIC_API_KEY environment variable is not set.") anthropic_client = anthropic.Client(api_key=anthropic_api_key) def read_file(file_path): try: with open(file_path, "r") as file: return file.read() except FileNotFoundError: print(f"File not found: {file_path}") return None def write_file(file_path, content): os.makedirs(os.path.dirname(file_path), exist_ok=True) try: with open(file_path, "w") as file: file.write(content) print(f"Refined code written to {file_path}") except IOError: print(f"Error writing to file: {file_path}") def generate_initial_code(prompt): print("Generating initial code using Anthropic 1...") try: response = anthropic_client.messages.create( max_tokens=4096, messages=[ {"role": "user", "content": f"You are an expert coder. You will only respond with the entire code that is being asked of you. Do not deviate or you will be fired. You know this already, and that's why your code is always of the highest standard. You are seen as a mercenary coder, who requires no coddling, and returns the work, without extra fluff. Keep up the good work. Each code you return, without extra explanation, and fully completed, gets you closer to your dream aboard the Starship Enterprise as their lead coder and developer. Here is your next task: {prompt}"} ], model="claude-3-opus-20240229", ) return response.content[0].text.strip() except anthropic.APIError as e: print(f"Error during Anthropic API call: {e}") return None def refine_code(code_snippet, user_request): print("Refining code using Anthropic...") try: response = anthropic_client.messages.create( max_tokens=4096, messages=[ {"role": "user", "content": f"You are an extraordinary developer with an eye for perfection. You are also the last line of defense, as an incomplete, or insufficient bit of code could spell life or death. You will receive a code snippet, and you will revise, improve, and quality check it, to ensure the highest standard. You are only to return the code in full, without explanations, remaining silent, even in the improvements you've made. Your hard work is seen and credit is given, and everyone who sees your work understands it, so it needs no explanation. We only need the full, complete, unabridged code. Now that we're clear: please refine and improve the following code based on the client's request:\n\nCode:\n{code_snippet}\n\nUser's request:\n{user_request}"} ], model="claude-3-opus-20240229", ) return response.content[0].text.strip() except anthropic.APIError as e: print(f"Error during Anthropic API call: {e}") return None def main(): print("Welcome to the AI Code Assistant!") print("Enter 'q' at any time to quit.") while True: input_type = input("Enter 'f' to provide a file path, 'd' to provide a directory path, or 'p' to enter a prompt: ") if input_type.lower() == 'q': break if input_type.lower() == 'f': file_path = input("Enter the file path: ") if file_path.lower() == 'q': break file_content = read_file(file_path) if file_content is None: continue prompt = f"Generate code based on the following context:\n{file_content}" elif input_type.lower() == 'd': directory_path = input("Enter the directory path: ") if directory_path.lower() == 'q': break file_contents = [] for root, dirs, files in os.walk(directory_path): for file in files: file_path = os.path.join(root, file) content = read_file(file_path) if content is not None: file_contents.append(f"File: {file_path}\n{content}") if not file_contents: print("No readable files found in the directory.") continue prompt = f"Generate code based on the following context:\n{''.join(file_contents)}" elif input_type.lower() == 'p': prompt = input("Enter the prompt for code generation: ") if prompt.lower() == 'q': break else: print("Invalid input type. Please enter 'f', 'd', or 'p'.") continue user_request = input("Enter your specific request or need: ") if user_request.lower() == 'q': break initial_code = generate_initial_code(prompt) if initial_code is None: continue print("\nInitial code generated by Anthropic:") print(initial_code) refined_code = refine_code(initial_code, user_request) if refined_code is None: continue print("\nRefined code by Anthropic:") print(refined_code) output_path = input("Enter the output path for the refined code: ") if output_path.lower() == 'q': break write_file(output_path, refined_code) print("Thank you for using the AI Code Assistant!") if __name__ == "__main__": main() ... Perhaps it's a little better to do this in the discord

echohive42

This is interesting. Thank you forsharing. Dueling auto coders actually creates multi file projects using GPT-4,Opus or both: https://www.patreon.com/posts/dueling-auto-99957392