(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43580012

Hacker News 上的一篇文章讨论了在 TypeScript 中使用 Gemini API 并以 OpenAI 作为备选方案,并参考了 sometechblog.com 上的一篇博文。一位评论者推荐使用 Vercel AI SDK 作为替代方案,因为它能够跨多个大型语言模型(包括本地模型)进行抽象,并使用 Zod 进行类型验证,从而方便模型切换。另一位评论者批评了 TypeScript 的视觉美观性,将其与 PHP 不利地对比,认为每行开头明显的关键字妨碍了代码扫描的可读性。

相关文章

原文
Hacker News new | past | comments | ask | show | jobs | submit login
Use the Gemini API with OpenAI Fallback in TypeScript (sometechblog.com)
3 points by l5870uoo9y 1 hour ago | hide | past | favorite | 2 comments










The Vercel AI SDK abstracts against all LLMs, including locally running ones.

https://sdk.vercel.ai/docs/introduction

It uses zod for types and validation, I've loved using it to make my apps swap between models easily.



Typescript looks so ugly visually. It gives me PHP vibes. I think it's the large words at the first column of the eye line:

export const

function

type

return

etc

This makes scanning through the code really hard because your eye has to jump horizontally.







Join us for AI Startup School this June 16-17 in San Francisco!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



Search:
联系我们 contact @ memedata.com