Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For what LangChain does, yes, handrolled code. There won't be much of it because it doesn't actually do all that much.

As for "import openai", that's actually somewhat orthogonal, but if what you want is a common API for different providers then there are many options around that do just that. But then again at that point you probably also want something like OpenRouter, which has its own generic API.





I’ve been using the following pattern since gpt3, the only other thing I have changed was added another parameter for schema for structured output. People really love to overcomplicate things.

class AI(Protocol):

def call_llm(prompt: str) -> str: …




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

Search: