mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
feat(ai): Rename package to @mariozechner/pi-ai and improve documentation
- Changed package name from @mariozechner/ai to @mariozechner/pi-ai - Fixed generate-models.ts to fetch from models.dev API instead of local file - Completely rewrote README with practical examples: - Image input with base64 encoding - Proper tool calling with context management - Streaming with completion indicators - Abort signal usage - Provider-specific options (reasoning/thinking) - Custom model definitions for local/self-hosted LLMs - Environment variables explanation - Bumped version to 0.5.9 and published
This commit is contained in:
parent
796e48b80e
commit
d46a98ec10
13 changed files with 388 additions and 210 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env tsx
|
||||
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { writeFileSync } from "fs";
|
||||
import { join, dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
|
|
@ -164,10 +164,11 @@ async function fetchOpenRouterModels(): Promise<NormalizedModel[]> {
|
|||
}
|
||||
}
|
||||
|
||||
function loadModelsDevData(): NormalizedModel[] {
|
||||
async function loadModelsDevData(): Promise<NormalizedModel[]> {
|
||||
try {
|
||||
console.log("Loading models from models.json...");
|
||||
const data = JSON.parse(readFileSync(join(packageRoot, "src/models.json"), "utf-8"));
|
||||
console.log("Fetching models from models.dev API...");
|
||||
const response = await fetch("https://models.dev/api.json");
|
||||
const data = await response.json();
|
||||
|
||||
const models: NormalizedModel[] = [];
|
||||
|
||||
|
|
@ -232,7 +233,7 @@ function loadModelsDevData(): NormalizedModel[] {
|
|||
async function generateModels() {
|
||||
// Fetch all models
|
||||
const openRouterModels = await fetchOpenRouterModels();
|
||||
const modelsDevModels = loadModelsDevData();
|
||||
const modelsDevModels = await loadModelsDevData();
|
||||
|
||||
// Combine models (models.dev takes priority for Groq/Cerebras)
|
||||
const allModels = [...modelsDevModels, ...openRouterModels];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue