Accessing Claude with the API
prompt
prompt gives idea to llm for ans. llm dont have memory so create memory like array and append all chain msg to new prompt, so llm get contex.
role may be user, assistant, system.
one query one ans context lost so we make chain of thought concept.
Temperature
- Tokenization - Breaking your input into smaller chunks
- Prediction - Calculating probabilities for possible next words
- Sampling - Choosing a token based on those probabilities
Low Temperature (0.0 - 0.3) Factual responses
Medium Temperature (0.4 - 0.7) Summarization
High Temperature (0.8 - 1.0) Creative writing
Response streaming
- MessageStart - A new message is being sent
- ContentBlockStart - Start of a new block containing text, tool use, or other content
- ContentBlockDelta - Chunks of the actual generated text
- ContentBlockStop - The current content block has been completed
- MessageDelta - The current message is complete
- MessageStop - End of information about the current message
The ContentBlockDelta events contain the actual generated text that you'll want to display to users.
Structured data