Taking Building with the Claude API. Notes from today

  • Anthropic API and Claude do not store any messages you send and it sends back – if you want context or flow – you need to maintain in your code msgs exchanged and list is provided in follow-up requests
  • You need to add a helper function like this
def add_user_message(messages, text):
    user_message = {"role": "user", "content": text}
    messages.append(user_message)
def add_assistant_message(messages, text):
    assistant_message = {"role": "assistant", "content": text}
    messages.append(assistant_message)
def chat(messages):
    message = client.messages.create(
        model=model,
        max_tokens=1000,
        messages=messages,
    )
    return message.content[0].text

Chat Bot Exercise 

  • Used claude to generate chatbot code with prompt: create chatbot code that uses built in input function in jupyter notebook, prompt user to input using the built-in input function,  add user input to list of messages, call claude api with chat function, add generated text to list of messages, print generated text 
  • needed to debug for empty input case once 
conversation_history = []
def chat(user_message):
    conversation_history.append({
        "role": "user",
        "content": user_message
    })
    response = client.messages.create(
        model=model,
        max_tokens=1000,
        messages=conversation_history
    )
    assistant_message = response.content[0].text
    conversation_history.append({
        "role": "assistant",
        "content": assistant_message
    })
    print(f"\nClaude: {assistant_message}\n")
    return assistant_message
# Run the chatbot
while True:
    user_input = input("You: ")
    if not user_input.strip():
        print("Please type something.")
        continue
    if user_input.lower() in ["quit", "exit", "bye"]:
        print("Ending conversation.")
        break
    chat(user_input)

Aidentic (How To) | Supercharge Your Figma Workflow with AI Plugins | Treehouse

  • Make sure projects set to right visibility to use an external plug-in tool to evaluate things like paragraph spacing, font, etc. 

Studying Anthropic Support Docs as a PM and used the following prompt and response from Claude to guide me. Key Takeaways

  • Finding the right product fit for right user person
  • Strong play into enterprise and government solving blocking pain points like identity management
  • Seems like Dev need docs beyond regular docs 
  • Connectors etc are building Claude into existing workflows, eg. AWS Bedrock letting Claude run in existing infrastructure
  • Safeguards is part of Claude’s brand identity in a way and trying it as a product value 
  • Bottoms up adoption pattern but they are totally enterprise ready 

The internal AI tool that’s transforming how Stripe designs products | Owen Williams

  • Made internal dashboarding prototyping tool with a bundle of Cursor rules with React attached to it, pretty much used to be impossible to prototype dashboards given state management, filters, etc.
    • More PMs using it then designers, but designers can take prototype from there
  • PMs were rewarded for being able to convince designs and engineering and politicking more than building in the old world when design or eng teams “owned” prototypes
  • AI takes away the whole git workflow env config from designers and PMs to run dev, no more messing with React routers
  • Key challenge and win is integrated vibe coded internal tools into operating infrastructure
  • Integrate your design system, components, and dev env to avoid dashboard slop
  • Use an annotate for AI feature to make fixes easier 

Re-reading The Second Machine Age and reading Empire of AI 

Posted in , ,

Leave a Reply