Start implementing a basic support for LLMs

This commit is contained in:
Dmitrii Okunev
2025-04-28 00:28:01 +01:00
parent 37d0751c3b
commit c64b3b12bb
18 changed files with 1897 additions and 595 deletions

View File

@@ -2805,3 +2805,28 @@ func (c *Client) DialPeerByID(
) (api.StreamD, error) {
return nil, fmt.Errorf("not implemented, yet")
}
func (c *Client) LLMGenerate(
ctx context.Context,
prompt string,
) (string, error) {
resp, err := withStreamDClient(ctx, c, func(
ctx context.Context,
client streamd_grpc.StreamDClient,
conn io.Closer,
) (*streamd_grpc.LLMGenerateReply, error) {
return callWrapper(
ctx,
c,
client.LLMGenerate,
&streamd_grpc.LLMGenerateRequest{
Prompt: prompt,
},
)
})
if err != nil {
return "", fmt.Errorf("unable to submit the event: %w", err)
}
return resp.GetResponse(), nil
}