Safetensors
GGUF
Turkish
llama
Llama-3
instruct
finetune
chatml
gpt4
synthetic data
distillation
function calling
json mode
axolotl
roleplaying
chat
Instructions to use tda45/TdAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use tda45/TdAI with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="tda45/TdAI", filename="llama.cpp/models/ggml-vocab-aquila.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use tda45/TdAI with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf tda45/TdAI # Run inference directly in the terminal: llama cli -hf tda45/TdAI
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf tda45/TdAI # Run inference directly in the terminal: llama cli -hf tda45/TdAI
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf tda45/TdAI # Run inference directly in the terminal: ./llama-cli -hf tda45/TdAI
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf tda45/TdAI # Run inference directly in the terminal: ./build/bin/llama-cli -hf tda45/TdAI
Use Docker
docker model run hf.co/tda45/TdAI
- LM Studio
- Jan
- Ollama
How to use tda45/TdAI with Ollama:
ollama run hf.co/tda45/TdAI
- Unsloth Studio
How to use tda45/TdAI with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for tda45/TdAI to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for tda45/TdAI to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for tda45/TdAI to start chatting
- Atomic Chat new
- Docker Model Runner
How to use tda45/TdAI with Docker Model Runner:
docker model run hf.co/tda45/TdAI
- Lemonade
How to use tda45/TdAI with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull tda45/TdAI
Run and chat with the model
lemonade run user.TdAI-{{QUANT_TAG}}List all available models
lemonade list
| /** | |
| * @deprecated Legacy migration utility — remove at some point in the future once all users have migrated to the new structured agentic message format. | |
| * | |
| * Converts old marker-based agentic messages to the new structured format | |
| * with separate messages per turn. | |
| * | |
| * Old format: Single assistant message with markers in content: | |
| * <<<reasoning_content_start>>>...<<<reasoning_content_end>>> | |
| * <<<AGENTIC_TOOL_CALL_START>>>...<<<AGENTIC_TOOL_CALL_END>>> | |
| * | |
| * New format: Separate messages per turn: | |
| * - assistant (content + reasoningContent + toolCalls) | |
| * - tool (toolCallId + content) | |
| * - assistant (next turn) | |
| * - ... | |
| */ | |
| import { LEGACY_AGENTIC_REGEX, LEGACY_REASONING_TAGS } from '$lib/constants'; | |
| import { DatabaseService } from '$lib/services/database.service'; | |
| import { MessageRole, MessageType } from '$lib/enums'; | |
| import type { DatabaseMessage } from '$lib/types/database'; | |
| const MIGRATION_DONE_KEY = 'llama-ui-migration-v2-done'; | |
| /** @deprecated Use {@link MIGRATION_DONE_KEY} instead */ | |
| const DEPRECATED_MIGRATION_DONE_KEY = 'llama-webui-migration-v2-done'; | |
| /** | |
| * @deprecated Part of legacy migration — remove with the migration module. | |
| * Check if migration has been performed. | |
| */ | |
| export function isMigrationNeeded(): boolean { | |
| try { | |
| // Check new key first, fall back to deprecated old key | |
| if (localStorage.getItem(MIGRATION_DONE_KEY)) return false; | |
| if (localStorage.getItem(DEPRECATED_MIGRATION_DONE_KEY)) { | |
| // Migrate to new key | |
| try { | |
| localStorage.setItem(MIGRATION_DONE_KEY, String(Date.now())); | |
| localStorage.removeItem(DEPRECATED_MIGRATION_DONE_KEY); | |
| } catch { | |
| // Ignore storage errors | |
| } | |
| return false; | |
| } | |
| return true; | |
| } catch { | |
| return false; | |
| } | |
| } | |
| /** | |
| * Mark migration as done. | |
| */ | |
| function markMigrationDone(): void { | |
| try { | |
| localStorage.setItem(MIGRATION_DONE_KEY, String(Date.now())); | |
| } catch { | |
| // Ignore localStorage errors | |
| } | |
| } | |
| /** | |
| * Check if a message has legacy markers in its content. | |
| */ | |
| function hasLegacyMarkers(message: DatabaseMessage): boolean { | |
| if (!message.content) return false; | |
| return LEGACY_AGENTIC_REGEX.HAS_LEGACY_MARKERS.test(message.content); | |
| } | |
| /** | |
| * Extract reasoning content from legacy marker format. | |
| */ | |
| function extractLegacyReasoning(content: string): { reasoning: string; cleanContent: string } { | |
| let reasoning = ''; | |
| let cleanContent = content; | |
| // Extract all reasoning blocks | |
| const re = new RegExp(LEGACY_AGENTIC_REGEX.REASONING_EXTRACT.source, 'g'); | |
| let match; | |
| while ((match = re.exec(content)) !== null) { | |
| reasoning += match[1]; | |
| } | |
| // Remove reasoning tags from content | |
| cleanContent = cleanContent | |
| .replace(new RegExp(LEGACY_AGENTIC_REGEX.REASONING_BLOCK.source, 'g'), '') | |
| .replace(LEGACY_AGENTIC_REGEX.REASONING_OPEN, ''); | |
| return { reasoning, cleanContent }; | |
| } | |
| /** | |
| * Parse legacy content with tool call markers into structured turns. | |
| */ | |
| interface ParsedTurn { | |
| textBefore: string; | |
| toolCalls: Array<{ | |
| name: string; | |
| args: string; | |
| result: string; | |
| }>; | |
| } | |
| function parseLegacyToolCalls(content: string): ParsedTurn[] { | |
| const turns: ParsedTurn[] = []; | |
| const regex = new RegExp(LEGACY_AGENTIC_REGEX.COMPLETED_TOOL_CALL.source, 'g'); | |
| let lastIndex = 0; | |
| let currentTurn: ParsedTurn = { textBefore: '', toolCalls: [] }; | |
| let match; | |
| while ((match = regex.exec(content)) !== null) { | |
| const textBefore = content.slice(lastIndex, match.index).trim(); | |
| // If there's text between tool calls and we already have tool calls, | |
| // that means a new turn started (text after tool results = new LLM turn) | |
| if (textBefore && currentTurn.toolCalls.length > 0) { | |
| turns.push(currentTurn); | |
| currentTurn = { textBefore, toolCalls: [] }; | |
| } else if (textBefore && currentTurn.toolCalls.length === 0) { | |
| currentTurn.textBefore = textBefore; | |
| } | |
| currentTurn.toolCalls.push({ | |
| name: match[1], | |
| args: match[2], | |
| result: match[3].replace(/^\n+|\n+$/g, '') | |
| }); | |
| lastIndex = match.index + match[0].length; | |
| } | |
| // Any remaining text after the last tool call | |
| const remainingText = content.slice(lastIndex).trim(); | |
| if (currentTurn.toolCalls.length > 0) { | |
| turns.push(currentTurn); | |
| } | |
| // If there's text after all tool calls, it's the final assistant response | |
| if (remainingText) { | |
| // Remove any partial/open markers | |
| const cleanRemaining = remainingText | |
| .replace(LEGACY_AGENTIC_REGEX.AGENTIC_TOOL_CALL_OPEN, '') | |
| .trim(); | |
| if (cleanRemaining) { | |
| turns.push({ textBefore: cleanRemaining, toolCalls: [] }); | |
| } | |
| } | |
| // If no tool calls found at all, return the original content as a single turn | |
| if (turns.length === 0) { | |
| turns.push({ textBefore: content.trim(), toolCalls: [] }); | |
| } | |
| return turns; | |
| } | |
| /** | |
| * Migrate a single conversation's messages from legacy format to new format. | |
| */ | |
| async function migrateConversation(convId: string): Promise<number> { | |
| const allMessages = await DatabaseService.getConversationMessages(convId); | |
| let migratedCount = 0; | |
| for (const message of allMessages) { | |
| if (message.role !== MessageRole.ASSISTANT) continue; | |
| if (!hasLegacyMarkers(message)) { | |
| // Still check for reasoning-only markers (no tool calls) | |
| if (message.content?.includes(LEGACY_REASONING_TAGS.START)) { | |
| const { reasoning, cleanContent } = extractLegacyReasoning(message.content); | |
| await DatabaseService.updateMessage(message.id, { | |
| content: cleanContent.trim(), | |
| reasoningContent: reasoning || undefined | |
| }); | |
| migratedCount++; | |
| } | |
| continue; | |
| } | |
| // Has agentic markers - full migration needed | |
| const { reasoning, cleanContent } = extractLegacyReasoning(message.content); | |
| const turns = parseLegacyToolCalls(cleanContent); | |
| // Parse existing toolCalls JSON to try to match IDs | |
| let existingToolCalls: Array<{ | |
| id: string; | |
| function?: { name: string; arguments: string }; | |
| }> = []; | |
| if (message.toolCalls) { | |
| try { | |
| existingToolCalls = JSON.parse(message.toolCalls); | |
| } catch { | |
| // Ignore | |
| } | |
| } | |
| // First turn uses the existing message | |
| const firstTurn = turns[0]; | |
| if (!firstTurn) continue; | |
| // Match tool calls from the first turn to existing IDs | |
| const firstTurnToolCalls = firstTurn.toolCalls.map((tc, i) => { | |
| const existing = | |
| existingToolCalls.find((e) => e.function?.name === tc.name) || existingToolCalls[i]; | |
| return { | |
| id: existing?.id || `legacy_tool_${i}`, | |
| type: 'function' as const, | |
| function: { name: tc.name, arguments: tc.args } | |
| }; | |
| }); | |
| // Update the existing message for the first turn | |
| await DatabaseService.updateMessage(message.id, { | |
| content: firstTurn.textBefore, | |
| reasoningContent: reasoning || undefined, | |
| toolCalls: firstTurnToolCalls.length > 0 ? JSON.stringify(firstTurnToolCalls) : '' | |
| }); | |
| let currentParentId = message.id; | |
| let toolCallIdCounter = existingToolCalls.length; | |
| // Create tool result messages for the first turn | |
| for (let i = 0; i < firstTurn.toolCalls.length; i++) { | |
| const tc = firstTurn.toolCalls[i]; | |
| const toolCallId = firstTurnToolCalls[i]?.id || `legacy_tool_${i}`; | |
| const toolMsg = await DatabaseService.createMessageBranch( | |
| { | |
| convId, | |
| type: MessageType.TEXT, | |
| role: MessageRole.TOOL, | |
| content: tc.result, | |
| toolCallId, | |
| timestamp: message.timestamp + i + 1, | |
| toolCalls: '', | |
| children: [] | |
| }, | |
| currentParentId | |
| ); | |
| currentParentId = toolMsg.id; | |
| } | |
| // Create messages for subsequent turns | |
| for (let turnIdx = 1; turnIdx < turns.length; turnIdx++) { | |
| const turn = turns[turnIdx]; | |
| const turnToolCalls = turn.toolCalls.map((tc, i) => { | |
| const idx = toolCallIdCounter + i; | |
| const existing = existingToolCalls[idx]; | |
| return { | |
| id: existing?.id || `legacy_tool_${idx}`, | |
| type: 'function' as const, | |
| function: { name: tc.name, arguments: tc.args } | |
| }; | |
| }); | |
| toolCallIdCounter += turn.toolCalls.length; | |
| // Create assistant message for this turn | |
| const assistantMsg = await DatabaseService.createMessageBranch( | |
| { | |
| convId, | |
| type: MessageType.TEXT, | |
| role: MessageRole.ASSISTANT, | |
| content: turn.textBefore, | |
| timestamp: message.timestamp + turnIdx * 100, | |
| toolCalls: turnToolCalls.length > 0 ? JSON.stringify(turnToolCalls) : '', | |
| children: [], | |
| model: message.model | |
| }, | |
| currentParentId | |
| ); | |
| currentParentId = assistantMsg.id; | |
| // Create tool result messages for this turn | |
| for (let i = 0; i < turn.toolCalls.length; i++) { | |
| const tc = turn.toolCalls[i]; | |
| const toolCallId = turnToolCalls[i]?.id || `legacy_tool_${toolCallIdCounter + i}`; | |
| const toolMsg = await DatabaseService.createMessageBranch( | |
| { | |
| convId, | |
| type: MessageType.TEXT, | |
| role: MessageRole.TOOL, | |
| content: tc.result, | |
| toolCallId, | |
| timestamp: message.timestamp + turnIdx * 100 + i + 1, | |
| toolCalls: '', | |
| children: [] | |
| }, | |
| currentParentId | |
| ); | |
| currentParentId = toolMsg.id; | |
| } | |
| } | |
| // Re-parent any children of the original message to the last created message | |
| // (the original message's children list was the next user message or similar) | |
| if (message.children.length > 0 && currentParentId !== message.id) { | |
| for (const childId of message.children) { | |
| // Skip children we just created (they were already properly parented) | |
| const child = allMessages.find((m) => m.id === childId); | |
| if (!child) continue; | |
| // Only re-parent non-tool messages that were original children | |
| if (child.role !== MessageRole.TOOL) { | |
| await DatabaseService.updateMessage(childId, { parent: currentParentId }); | |
| // Add to new parent's children | |
| const newParent = await DatabaseService.getConversationMessages(convId).then((msgs) => | |
| msgs.find((m) => m.id === currentParentId) | |
| ); | |
| if (newParent && !newParent.children.includes(childId)) { | |
| await DatabaseService.updateMessage(currentParentId, { | |
| children: [...newParent.children, childId] | |
| }); | |
| } | |
| } | |
| } | |
| // Clear re-parented children from the original message | |
| await DatabaseService.updateMessage(message.id, { children: [] }); | |
| } | |
| migratedCount++; | |
| } | |
| return migratedCount; | |
| } | |
| /** | |
| * @deprecated Part of legacy migration — remove with the migration module. | |
| * Run the full migration across all conversations. | |
| * This should be called once at app startup if migration is needed. | |
| */ | |
| export async function runLegacyMigration(): Promise<void> { | |
| if (!isMigrationNeeded()) return; | |
| if (import.meta.env.DEV && import.meta.env.VITE_DEBUG) | |
| console.log('[Migration] Starting legacy message format migration...'); | |
| try { | |
| const conversations = await DatabaseService.getAllConversations(); | |
| let totalMigrated = 0; | |
| for (const conv of conversations) { | |
| const count = await migrateConversation(conv.id); | |
| totalMigrated += count; | |
| } | |
| if (import.meta.env.DEV && import.meta.env.VITE_DEBUG) { | |
| if (totalMigrated > 0) { | |
| console.log( | |
| `[Migration] Migrated ${totalMigrated} messages across ${conversations.length} conversations` | |
| ); | |
| } else { | |
| console.log('[Migration] No legacy messages found, marking as done'); | |
| } | |
| } | |
| markMigrationDone(); | |
| } catch (error) { | |
| console.error('[Migration] Failed to migrate legacy messages:', error); | |
| // Still mark as done to avoid infinite retry loops | |
| markMigrationDone(); | |
| } | |
| } | |