| title | PraisonAI Code |
|---|---|
| description | Guide to PraisonAI's code interface for interacting with your codebase using AI, including file management, model configuration, and advanced features |
| icon | code |
PraisonAI Code helps you to interact with your whole codebase using the power of AI.
| Interface | Description | URL |
|---|---|---|
| UI | Multi Agents such as CrewAI or AG2 | https://docs.praison.ai/ui/ui |
| Chat | Chat with 100+ LLMs, single AI Agent | https://docs.praison.ai/ui/chat |
| Code | Chat with entire Codebase, single AI Agent | https://docs.praison.ai/ui/code |
pip install "praisonai[code]"export OPENAI_API_KEY=xxxxxxxxpraisonai code-
Username and Password will be asked for the first time.
adminis the default username and password. -
Set Model name to be gpt-4o-mini in the settings
- Use 100+ LLMs - Litellm
- Includes Gemini 1.5 for 2 Million Context Length
export GEMINI_API_KEY=xxxxxxxxxpraisonai code- Set Model name to be
gemini/gemini-1.5-flashin the settings
- Create a
.praisonignorefile in the root folder of the project - Add files to ignore
.*
*.pyc
pycache
.git
.gitignore
.vscode
.idea
.DS_Store
.lock
.pyc
.env(.praisonignore is preferred)
- Create a
settings.yamlfile in the root folder of the project - Add below Variables and required Ignore Files
code:
ignore_files:
- ".*"
- "*.pyc"
- "pycache"
- ".git"
- ".gitignore"
- ".vscode"
- ".idea"
- ".DS_Store"
- ".lock"
- ".pyc"
- ".env"- Create a
.envfile in the root folder of the project - Add below Variables and required Ignore Files
PRAISONAI_IGNORE_FILES=".*,*.pyc,__pycache__,.git,.gitignore,.vscode"export PRAISONAI_IGNORE_FILES=".*,*.pyc,__pycache__,.git,.gitignore,.vscode"- Add files you wish to Include files in the context
- This will include the files/folders mentioned in
.praisonincludeto the original context (files in the folder - .gitignore - .praisonignore)
- Create a
.praisonincludefile in the root folder of the project - Add files to Include
projectfiles
docs- Add files you wish to Include files in the context
- This will include ONLY the files/folders mentioned in
.praisoncontextto the context
- Create a
.praisoncontextfile in the root folder of the project - Add files to Include
projectfiles
docsNote: By Default Max Tokens set is 900,000
export PRAISONAI_MAX_TOKENS=1000000or
- Create a .env file in the root folder of the project
- Add below Variables and required Max Tokens
-
PRAISONAI_MAX_TOKENS=1000000
~/.praison/database.sqlite
PraisonAI Code now includes internet search capabilities using Crawl4AI and Tavily. This feature allows you to retrieve up-to-date information and code snippets during your coding sessions, enhancing your ability to find relevant programming information and examples.
To use this feature:
- Ask a question or request information about a specific coding topic
- The AI will use internet search to find the most relevant and current information
- You'll receive code snippets, documentation references, or explanations based on the latest available resources
While primarily designed for code interactions, PraisonAI Code also supports Vision Language Model capabilities. This feature can be particularly useful when dealing with visual aspects of programming, such as UI design, data visualization, or understanding code structure through diagrams.
To use this feature:
- Upload an image related to your coding query (e.g., a screenshot of a UI, a flowchart, or a code snippet image)
- Ask questions or request analysis based on the uploaded image
- The VLM will process the image and provide insights or answers based on its visual content, helping you understand or implement the visual concepts in your code
These new features significantly expand the capabilities of PraisonAI Code, allowing for more comprehensive and up-to-date coding assistance.
To facilitate local development with live reload, you can use Docker. Follow the steps below:
-
Create a
Dockerfile.dev:FROM python:3.11-slim WORKDIR /app COPY . . RUN pip install flask praisonai==2.2.25 watchdog EXPOSE 5555 ENV FLASK_ENV=development CMD ["flask", "run", "--host=0.0.0.0"]
-
Create a
docker-compose.yml:version: '3.8' services: app: build: context: . dockerfile: Dockerfile.dev volumes: - .:/app ports: - "5555:5555" environment: FLASK_ENV: development command: flask run --host=0.0.0.0 watch: image: alpine:latest volumes: - .:/app command: sh -c "apk add --no-cache inotify-tools && while inotifywait -r -e modify,create,delete /app; do kill -HUP 1; done"
-
Run Docker Compose:
docker-compose up
This setup will allow you to develop locally with live reload, making it easier to test and iterate on your code.