MCPcopy
hub / github.com/TanStack/ai / resolveTransport

Function resolveTransport

packages/ai-client/src/chat-client.ts:77–90  ·  view source on GitHub ↗
(transport: {
  connection?: ConnectionAdapter
  fetcher?: ChatFetcher
})

Source from the content-addressed store, hash-verified

75}
76
77function resolveTransport(transport: {
78 connection?: ConnectionAdapter
79 fetcher?: ChatFetcher
80}): ConnectionAdapter {
81 const { connection, fetcher } = transport
82 if (connection && fetcher) {
83 throw new Error(
84 'ChatClient: pass either `connection` or `fetcher`, not both.',
85 )
86 }
87 if (connection) return connection
88 if (fetcher) return fetcherToConnectionAdapter(fetcher)
89 throw new Error('ChatClient: either `connection` or `fetcher` is required.')
90}
91
92export class ChatClient<
93 TTools extends ReadonlyArray<AnyClientTool> = any,

Callers 2

constructorMethod · 0.70
updateOptionsMethod · 0.70

Calls 1

Tested by

no test coverage detected