Urgent.News

What's breaking now, across thousands of outlets.

AI

把 AI CLI 包成 OpenAI 相容 API:從 stdin、JSON 輸出到逾時處理(附可跑範例)

一句話結論:把 CLI 接上 HTTP,核心是輸入、程序生命週期和輸出格式;路徑叫 /v1/chat/completions ,不代表已經支援整份協定。 遇到的問題 終端機裡已經有一個能回答問題的 AI CLI,但想接的程式只會送 HTTP 請求,兩邊講的是不同語言。 最先想到的是收到問題後跑一次 CLI,再把答案回傳。真的開始接才發現,容易出錯的地方全在中間:長 prompt 要怎麼傳?CLI 印出的 JSON 哪一段才是答案?指令卡住時,HTTP 要等多久? 這篇把實際包裝服務用到的做法縮成一個能在本機跑的範例。先用假的 CLI 驗證程序與協定,不需要模型金鑰,也不會消耗模型用量。 有實測的是 Python 包裝流程,沒有在這次測試中呼叫真實模型。 換成真實 CLI 時,登入、旗標與輸出格式仍要另外核對。 先決定相容到哪裡 範例只接受一則文字 user 訊息,回傳一次完整 JSON。…

Original Chinese Read in English

We haven't written up this one. Dev.to has the full story — the link below goes straight to it.

Read the original at dev.to →

More in AI

Bridging Context and Execution: An Engineering Assessment of Connected AI Workflows

Every engineering leader managing modern distributed systems eventually hits the same bottleneck: context fragmentation. Teams communicate decisions across Slack threads, Google Meets, Jira tickets…

  • Engineering teams struggle with context fragmentation across platforms.
  • AI initially seen as standalone tool, not integrated workflow.
  • GeekyAnts team analyzes architectural breakdown and execution challenges.

South Korea, Australia Deepen AI, Minerals Ties

The Korea Trade-Investment Promotion Agency, or KOTRA, held a regular consultation meeting with the Australian Trade and Investment Commission, Austrade, in Sydney, Australia, on Nov.

  • South Korea and Australia held AI, minerals cooperation meeting on November 5, 2023
  • Meeting aimed to explore AI, advanced industry supply chains, core minerals collaboration
  • Identified data center equipment, cybersecurity, industrial AI cooperation areas

More from Thursday 5 November →