Once you've set the format of \chapter using the titlesec \titleformat command you can set the spacing for the chapters using the \titlespacing* command. I've adjusted some of your code too. Two-letter font commands like \bf have been deprecated in LaTeX for decades, and you should not use them. Instead use \bfseries or \textbf{} as appropriate. Unless the format of the chapter number is different from the rest of the title, there's no need to add formatting to the last argument of the \titleformat command.
The \titlespacing* command takes four arguments:
\titlespacing*{<command>}{<left-margin>}{<space-before>}{<space-after>}
The book class sets these values to 0pt, 50pt and 40pt. To put the title at the top of the page, we can use a negative value for the space before argument. I've used -\baselineskip. If you want the title aligned flush with the top margin, you can use -1.5\baselineskip or use the code provided in the comment. If you want some space, but not the default 50pt then change this value to something that suits your needs.
\documentclass{book}
\usepackage[margin=2.5cm,showframe]{geometry}
\usepackage{titlesec}
\titleformat{\chapter}{\normalfont\Huge\bfseries}{\thechapter}{15pt}{}
\titlespacing*{\chapter}{0pt}{-\baselineskip}{20pt}
\begin{document}
\chapter{A chapter}
This is some text.
\end{document}

\documentclass{...}and end with\end{document}. This way people will be able to help you better. – Alan Munn Mar 18 '23 at 22:26