### Preview changes Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/quickstart.mdx Install the Mintlify CLI to preview the documentation changes locally. ```bash npm i -g mintlify ``` ```bash mintlify dev ``` -------------------------------- ### Python Virtual Environment Setup Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/compendium/python.mdx Commands to create and activate a Python virtual environment, and install dependencies. ```bash python -m venv .venv source .venv/bin/activate python -m pip install -U pip python -m pip install -r requirements.txt ``` -------------------------------- ### OpenAI client request Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/inference.mdx Example of an OpenAI client request to create a chat completion. ```python # Example of OpenAI client request import openai client = openai.OpenAI() chat_completion = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "What is the capital of France?"}] ) ``` -------------------------------- ### Install Mintlify using yarn Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/development.mdx Install Mintlify globally using yarn. ```bash yarn global add mintlify ``` -------------------------------- ### Install Mintlify using npm Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/development.mdx Install Mintlify globally using npm. ```bash npm i -g mintlify ``` -------------------------------- ### OpenAPI Configuration Examples Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/essentials/settings.mdx Examples demonstrating how to configure the 'openapi' setting with different URL types. ```json "openapi": "https://example.com/openapi.json" ``` ```json "openapi": "/openapi.json" ``` ```json "openapi": ["https://example.com/openapi1.json", "/openapi2.json", "/openapi3.json"] ``` -------------------------------- ### On-hardware inference: running python code on a CPU for llama-3 Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/inference.mdx Example of running Python code on a CPU for Llama-3 inference using llama-cpp. ```python from llama_cpp import Llama llama = Llama(model_path="/path/to/llama-3.1-8b.Q4_0.gguf", use_gpu=False) print(llama("Hello, world!")) ``` -------------------------------- ### On-hardware inference: running python code on a GPU for llama-3 Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/inference.mdx Example of running Python code on a GPU for Llama-3 inference using llama-cpp. ```python from llama_cpp import Llama llama = Llama(model_path="/path/to/llama-3.1-8b.Q4_0.gguf", use_gpu=True) print(llama("Hello, world!")) ``` -------------------------------- ### SimpleIcons Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/compendium/github.mdx Example of using a SimpleIcons logo with a badge. ```markdown ![](https://img.shields.io/npm/v/npm.svg?logo=nodedotjs) ``` -------------------------------- ### Multimodal inference with text and image inputs to OpenAI Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/inference.mdx Example of multimodal inference with text and image inputs to OpenAI's GPT-4o model. ```python import openai import requests from PIL import Image from io import BytesIO client = openai.OpenAI() image_url = "https://example.com/image.jpg" response = requests.get(image_url) img = Image.open(BytesIO(response.content)) chat_completion = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": "You are a helpful assistant that can analyze images."}, {"role": "user", "content": "Describe the contents of the image and tell me what is in the image."} ], image=img ) ``` -------------------------------- ### Logo Color Parameter Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/compendium/github.mdx Example demonstrating the logoColor parameter for changing logo color. ```markdown ![](https://img.shields.io/badge/logo-javascript-blue?logo=javascript) ``` ```markdown ![](https://img.shields.io/badge/logo-javascript-blue?logo=javascript&logoColor=f5f5f5) ``` -------------------------------- ### On-hardware inference: running python code on a GPU for gpt-neox Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/inference.mdx Example of running Python code on a GPU for GPT-NeoX inference using the transformers library. ```python from transformers import GPTNeoXForCausalLM, GPT2Tokenizer # Load the model model = GPTNeoXForCausalLM.from_pretrained("EleutherAI/gpt-neox-20b") # Run inference inputs = tokenizer("Hello, world!", return_tensors="pt") outputs = model.generate(**inputs, max_new_tokens=10) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` -------------------------------- ### Logo Color with Custom Logo Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/compendium/github.mdx Example showing logoColor parameter substituting SimpleIcons for custom multi-colored logos. ```markdown ![](https://img.shields.io/badge/logo-gitlab-blue?logo=gitlab) ``` ```markdown ![](https://img.shields.io/badge/logo-gitlab-blue?logo=gitlab&logoColor=white) ``` -------------------------------- ### Footer Socials Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/essentials/settings.mdx An example of how to configure social media links in the footer. ```json { "x": "https://x.com/mintlify", "website": "https://mintlify.com" } ``` -------------------------------- ### Start local development server Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/development.mdx Run the Mintlify development server from the docs directory. ```bash mintlify dev ``` -------------------------------- ### Initialize next-forge Source: https://github.com/mkirch/kirchner.io/blob/main/README.md Command to clone the next-forge repository and initialize a new project. ```sh npx next-forge@latest init ``` -------------------------------- ### Code Block Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/essentials/code.mdx Use fenced code blocks by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language. ```java class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } ``` -------------------------------- ### Custom Instructions - How to Respond Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/blog/chatgpt-library-knowledge.mdx This snippet provides detailed context about SwiftData, including its core features for data operations, object handling, storage, performance, and advanced functionalities, to be used in the 'How to Respond' section of Custom Instructions. ```swift When I request code, furnish it without annotations and prioritize efficiency. Acknowledge SwiftData—a recent Apple library for SwiftUI data management—with these core features: ### SwiftData: Data Operations - **Dynamic Operations**: Sorting and filtering via user input. - **Query**: `@Query` for object retrieval, filtering with `#Predicate`. - **Manipulation**: `.insert()` and `.delete()` to modify the model context. ### SwiftData: Object & Property Handling - **Model Transformation**: `@Model` macro for class-to-SwiftData model conversion. - **Property Binding**: `@Bindable` for object bindings. - **Computed Properties**: Unaffected by the `@Model` macro. ### SwiftData: Storage & Configuration - **Model Context**: Accessed via `@Environment(\.modelContext)`. - **Storage**: `.modelContainer(for:)` to initiate or load object storage. - **Customization**: `ModelContainer` customized via `ModelConfiguration`. ### SwiftData: Performance & Optimization - **Autosave**: Immediate autosaving of data changes, toggleable per `ModelContext`. - **Batch Operations**: Groups changes for efficiency and autosaves collectively. ### SwiftData: Advanced Features - **Relationships**: Defined by `@Relationship`, with custom delete rules. - **Uniqueness**: `@Attribute(.unique)` for unique property values. - **External Storage**: `.externalStorage` for large data like images. - **Derived Attributes**: Manual implementation through computed properties or `update()`. ``` -------------------------------- ### Development Server Commands Source: https://github.com/mkirch/kirchner.io/blob/main/apps/storybook/README.md Commands to run the development server using different package managers. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Custom Shields.io Logo Example Source: https://github.com/mkirch/kirchner.io/blob/main/apps/web/content/compendium/github.mdx Example of using a custom Shields.io logo with a badge. ```markdown ![](https://img.shields.io/npm/v/npm.svg?logo=npm) ``` -------------------------------- ### Run Mintlify on a custom port Source: https://github.com/mkirch/kirchner.io/blob/main/apps/docs/development.mdx Use the --port flag to specify a custom port for the Mintlify development server. ```bash mintlify dev --port 3333 ```