MCPcopy Create free account
hub / github.com/github/copilot-sdk / writeRaw

Method writeRaw

go/copilot_request_handler.go:773–800  ·  view source on GitHub ↗
(data string, binary bool)

Source from the content-addressed store, hash-verified

771}
772
773func (s *responseSink) writeRaw(data string, binary bool) error {
774 s.exchange.mu.Lock()
775 started := s.exchange.started
776 finished := s.exchange.finished
777 s.exchange.mu.Unlock()
778 if !started {
779 return fmt.Errorf("CopilotRequestHandler response sink Write() called before Start()")
780 }
781 if finished {
782 return fmt.Errorf("CopilotRequestHandler response sink Write() called after End()/Error()")
783 }
784 api, err := s.rpcAPI()
785 if err != nil {
786 return err
787 }
788 end := false
789 chunk := &rpc.LlmInferenceHTTPResponseChunkRequest{
790 RequestID: s.requestID,
791 Data: data,
792 End: &end,
793 }
794 if binary {
795 b := true
796 chunk.Binary = &b
797 }
798 _, err = api.HttpResponseChunk(context.Background(), chunk)
799 return err
800}
801
802func (s *responseSink) end() error {
803 s.exchange.mu.Lock()

Callers 2

writeTextMethod · 0.95
writeBinaryMethod · 0.95

Calls 2

rpcAPIMethod · 0.95
HttpResponseChunkMethod · 0.80

Tested by

no test coverage detected