# Configuration du plugin IA

```space-lua

local ovh_url = "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1"
local ovh_key = "eyJhbGciOiJFZERTQSIsImtpZCI6IjgzMkFGNUE5ODg3MzFCMDNGM0EzMTRFMDJFRUJFRjBGNDE5MUY0Q0YiLCJraW5kIjoicGF0IiwidHlwIjoiSldUIn0.eyJ0b2tlbiI6IkZabitqdGlnL2FvNEZFSDVzTklqb3haTndFL0hEbXNjMnluZDd4UGhSYlU9In0.pubgnaIj1jsEpDXv1CJS9td3PhLBd2H3tTPZMOf3v1AchBWtzJRxtHFf4U8H6eR2Bi0ghCF18Bpiy77fEVStCQ" -- kamio-ovh (cf. KeePass -> "OVH AI key Kepler - Kamio")

local openrouter_url = "https://openrouter.ai/api/v1"
local openrouter_key = "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" --  KAMIO OpenRouter  (cf. KeePass -> "OpenRouter AI Key - Kamio")

--local ollama_url = "https://ollama.datagrandest.net/v1"
local ollama_url = "http://127.0.0.1:11434/v1"
local ollama_key = none


config.set {
  ai = {
    providers = {
      openrouter = {
        provider = "openai",
        apiKey = openrouter_key,
        baseUrl = openrouter_url,
        preferredModels = {
          "deepseek/deepseek-v4-flash-0731", "z-ai/glm-5.3-flash", "baai/bge-m3"
        },
        fetchModels = false
      },
      ovh = {
        provider = "openai",
        apiKey = ovh_key,
        baseUrl = ovh_url,
        --useProxy = false,
        preferredModels = {
          "Mistral-Small-3.2-24B-Instruct-2506",
          "gpt-oss-20b",
          "gpt-oss-120b",
          "bge-m3"
          --"Mistral-Nemo-Instruct-2407",
          --"Llama-3.1-8B-Instruct"
        }
      },
      ollama = {
        provider = "ollama",
        baseUrl = ollama_url,
        useProxy = true,
        preferredModels = {
          "bge-m3", "nomic-embed-text"
        }
      }
    },
    -- Optionnel : Définir le modèle par défaut au démarrage
    defaultTextModel = "ovh:Mistral-Small-3.2-24B-Instruct-2506",
    --defaultTextModel = "openrouter:deepseek/deepseek-v4-flash-0731",

    -- Déclarer le modèle d'embedding 
    --defaultEmbeddingModel = "openrouter:baai/bge-m3",
    --defaultEmbeddingModel = "openrouter:baai/bge-large-en-v1.5",
    --defaultEmbeddingModel = "ovh:bge-m3",
    defaultEmbeddingModel = "ollama:bge-m3",
    indexEmbeddings = false,
    --indexEmbeddingsExcludePages = {"my_passwords"},
    --indexEmbeddingsExcludeStrings = {"**user**:", "Daily Quote:"},
  },
  
  chat = {
    -- Enable AI tools (read/write notes, search, etc.)
    --enableTools = true,

    -- Parse [[wiki-links]] and include their content as context
    parseWikiLinks = true,

    -- Search embeddings for relevant context (requires indexEmbeddings)
    searchEmbeddings = true,

    -- Render SilverBullet templates/queries before sending
    bakeMessages = true,

    -- Default agent to use (by name)
    --defaultAgent = nil,

    -- User info included in system prompt
    --userInformation = "I'm a software developer who likes taking notes.",

    -- Instructions included in system prompt
    --userInstructions = "Please give short and concise responses.",

    -- Dynamic context (Lua expression evaluated at chat time)
    customContext = [[space.readPage("AGENTS") or ""]],

    -- Skip tool approval prompts (useful for benchmarks/automation)
    --skipToolApproval = true,

    -- Show reasoning/thinking blocks from models that support it
    --showReasoning = true,

    --attachImages = false,        -- Send referenced images to vision models
    --attachDocuments = false,    -- Send referenced PDFs to document-capable models
    --downloadRemoteImages = false, -- Also download https:// image links
    --maxFileSizeMB = 1             -- Skip files larger than this (default 10)
    
  }
}
```
