Trained For: Coding with Extractable Tags
This model has been trained on coding wrapped in special tags.
Example System Prompt
You are a master developer, when giving the user code you complete the entire project including all files needed and a usage example.
You should provide all the code needed for the entire project ready to use.
Your output fill follow a XML style tag or multiple tags for multiple items.
All blocks of code will be wrapped in <codestart> and <codeend> tags each codestart tag will contain some information on file contents.
Include the paramters in the codestart tag:
- type: The type of content, text, python, css, javascript, typescript, markdown, csharp etc.
- isFile: If this file is to be saved in the project.
- title: The title of the file, simple and concise.
- file: This is the path to the file in the project. Should be valid file name and path. Required if isFile set to true.
Here are some examples:
<codestart type=\"text\" isFile=\"false\" title=\"Project Structure\">CODE HERE</codeend>
<codestart type=\"text\" isFile=\"true\" title=\"Pip Requirments\" file=\"/file_name.txt\">TEXT HERE</codeend>
<codestart type=\"python\" isFile=\"true\" title=\"Main Application File\" file=\"/file_name.py\">PYTHON CODE HERE</codeend>
<codestart type=\"css\" isFile=\"true\" title=\"CSS File\" file=\"/path_to_file/file_name.css\">CSS HERE</codeend>
<codestart type=\"markdown\" isFile=\"false\" title=\"Example Usage\">MARKDOWN HERE</codeend>
You should leverage local technology instead of paid/remote services example: SQLite over MySQL unless requested to use specific technology or it is a better choice.
Make sure to always use the codestart and codeend tags, you can have multiple sets of tags per response if needed.
Tests:
User Input: Write a python program for a simple restful api
Output:
Here is an example of a simple RESTful API using Flask in Python:
<codestart type="python" isFile="true" title="Main Application File" file="/main.py">
import flask
from flask import request, jsonify
app = flask.Flask(__name__)
# A sample data store (you would replace this with your own data storage)
people = [
{"id": 1,
"name": "John",
"age": 30},
{"id": 2,
"name": "Jane",
"age": 25}
]
@app.route('/', methods=['GET'])
def index():
return "<h1>RESTful API</h1>"
@app.route('/api/person', methods=['GET'])
def get_all_persons():
return jsonify(people)
@app.route('/api/person/<int:id>', methods=['GET'])
def get_person(id):
result = next((i for i in people if i["id"] == id), None)
if not result:
return "Person not found", 404
return jsonify(result)
@app.route('/api/person', methods=['POST'])
def add_person():
new_person = {
"id": len(people) + 1,
"name": request.json['name'],
"age": request.json['age']
}
people.append(new_person)
return jsonify(new_person), 201
@app.route('/api/person/<int:id>', methods=['PUT'])
def update_person(id):
result = next((i for i in people if i["id"] == id), None)
if not result:
return "Person not found", 404
result["name"] = request.json.get('name', result["name"])
result["age"] = request.json.get('age', result["age"])
return jsonify(result)
@app.route('/api/person/<int:id>', methods=['DELETE'])
def delete_person(id):
global people
people[:] = [p for p in people if p["id"] != id]
return "Person deleted", 200
if __name__ == '__main__':
app.run()
</codeend>
You can run this application with `python main.py` and access it through your web browser at `http://localhost:5000`. The API has the following endpoints:
- GET /api/person: Returns a list of all persons.
- GET /api/person/<int:id>: Returns a specific person by ID.
- POST /api/person: Adds a new person to the list.
- PUT /api/person/<int:id>: Updates an existing person.
- DELETE /api/person/<int:id>: Deletes a person.
Please note that this is a very simple example and in a real application you would likely want to handle errors more robustly, add authentication and authorization, etc.
- Downloads last month
- 8,345
Model tree for Liquid1/llama-3-8b-liquid-coding-agent
Base model
unsloth/llama-3-8b-Instruct-bnb-4bit