microsoft / TypeChat

TypeChat is a library that makes it easy to build natural language interfaces using types.
https://microsoft.github.io/TypeChat/
MIT License
8.06k stars 379 forks source link

feat: export createAxiosLanguageModel #94

Open abichinger opened 11 months ago

abichinger commented 11 months ago

Exporting createAxiosLanguageModel would solve the following problems

  1. support custom axios config (e.g. users can pass a proxy)
    related: #73 #55 #34
  2. ability to pass custom parameters to the endpoint /v1/chat/completions
DanielRosenwasser commented 11 months ago

Personally I don't think the library should expose Axios at all, since it's an internal implementation detail.

For example, in another issue someone asked about how to take advantage of streaming responses from OpenAI. Best I can tell, Axios doesn't make that easy to do (or it might not provide the APIs to do so at all). I use this as a specific example, but my point is really that hooking up Axios or whatever language model provider API is easy enough because TypeChatLanguageModel just needs a single function at the moment.

Still, I'll let others weigh in here.

snewell92 commented 11 months ago

@DanielRosenwasser thete are likely legit n/w level overrides desired, but middleware is likely the better way forward imo rather than anything axios/fetch/ky specific.

I agree with exposing the model the way it is with the single function 👍

Akimyou commented 10 months ago

I don't think TypeChat needs to provide proxy settings, as it can support proxy access through higher-level configurations, such as proxychains4.

moltar commented 10 months ago
  1. I think the package shall use undici as this will be the default client in the future Node versions
  2. If anything needs to be exposed, then I think FetchEsque types from trpc can be borrowed, which can adapt to any fetch implementation.