technovangelist.videoprojects/scripts/chatapi.txt
Matt Williams 1a49040e29 update code for 3-23 video on rag chunk size
Signed-off-by: Matt Williams <m@technovangelist.com>
2024-03-22 15:39:16 -07:00

11 lines
1.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Hey there, its matt, one of the maintainers of ollama. I wanted to introduce you to the chat api endpoint. One of our goals has always been to make the best tool for users and developers working with ai. So the main way to generate an answer from a model has always been the generate endpoint.
If you don't have Ollama yet, you can find it at ollama.ai. Click the download button and install it. You will get a CLI UI and a server that responds on a set of RESTful endpoints.
es input, then add that to a message and send all the messages to the chat function. that function outputs a message to the list of messages and I repeat. The chat function makes a call to the endpoint, passing the model and the messages. Then i cycle through the responses pulling out the content of each message which gets added to the output and printed to the screen. The full message then gets returned to the main function.
And thats it. You can see that working with the chat endpoint is easy, but maybe a bit more work than the generate endpoint. that extra work comes with the benefit of being able to do more with the history. For instance you can decide to keep the last 5 messages in full and to summarize anything older. or maybe you keep any short message and summarize the outputs with more than 100 words. Some folks are also finding that it allows alternate techniques like Chain of Thought prompting easier. I think thats pretty cool.
I can't wait to see what you do with it and hope you will share it with me in our discord, which you can find at discord.gg/ollama
Thanks so much for watching. goodbye.