Code Generation
Code
1from kern.agent import Agent2from kern.models.vllm import VLLM34agent = Agent(5 model=VLLM(id="deepseek-ai/deepseek-coder-6.7b-instruct"),6 description="You are an expert Python developer.",7 markdown=True,8)910agent.print_response(11 "Write a Python function that returns the nth Fibonacci number using dynamic programming."12)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall Libraries
1uv pip install -U kern-ai openai vllmStart vLLM server
1vllm serve deepseek-ai/deepseek-coder-6.7b-instruct \2 --dtype float32 \3 --tool-call-parser pythonicRun Agent
1python cookbook/11_models/vllm/code_generation.py