Skip to content

docs: add local quickstart#218

Closed
twishabansal wants to merge 18 commits into
mainfrom
quickstart
Closed

docs: add local quickstart#218
twishabansal wants to merge 18 commits into
mainfrom
quickstart

Conversation

@twishabansal

Copy link
Copy Markdown
Contributor

This quickstart helps users to onboard to toolbox quickly.

@github-actions

Copy link
Copy Markdown
Contributor

@twishabansal twishabansal marked this pull request as ready for review January 16, 2025 08:52
@twishabansal twishabansal requested a review from a team January 16, 2025 08:52
@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

Comment thread docs/en/getting-started/quickstart.md Outdated

---

## Step 1: Set up a database

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should their be a "before you begin" step? Are we assuming the user has any tools installed or running a specific environment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, we're not assuming anything about the user environment, except that they have python installed.
We're going over the whole process from scratch.

Comment thread docs/en/getting-started/quickstart.md Outdated
Comment on lines +11 to +15
[Install postgres and configure a
database](https://neon.tech/postgresql/postgresql-getting-started) for your
system.

This process creates a database `postgres` with superuser `postgres`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see if we can capture this set up ourselves, without requiring the user to go to a new page. I think using docker might also be useful in streamlining?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, can we assume basic familiarity with docker and have docker installation as a prerequisite?
Do you think the friction of docker installation is worth ignoring?

Comment thread docs/en/getting-started/quickstart.md Outdated
Comment thread docs/en/getting-started/quickstart.md Outdated
Comment thread docs/en/getting-started/quickstart.md
Comment thread docs/en/getting-started/quickstart.md Outdated
Comment on lines +206 to +254
1. Create a LangGraph [ReAct
agent](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent).

```python
from langgraph.prebuilt import create_react_agent
from langchain_google_vertexai import ChatVertexAI
from langgraph.checkpoint.memory import MemorySaver

model = ChatVertexAI(model_name="gemini-pro", project="my-project") # Change the GCP project here
agent = create_react_agent(model, tools, checkpointer=MemorySaver())
```

1. Define the initial prompt and user queries.

```python
prompt = """
You're a helpful hotel assistant. You handle hotel searching, booking and
cancellations. When the user searches for a hotel, mention it's name, id,
location and price tier. Always mention hotel ids while performing any
searches. This is very important for any operations. For any bookings or
cancellations, please provide the appropriate confirmation.
Don't ask for confirmations from the user.
"""

queries = [
"Find hotels in Basel with Basel in it's name.",
"Can you book the Hilton Basel for me?",
"Oh wait, this is too expensive. Please cancel it and book the Hyatt Regency instead.",
"My check in dates would be from April 10, 2024 to April 19, 2024.",
]
```

1. Run the queries and observe the output!

```python
config = {"configurable": {"thread_id": "thread-1"}}

for query in queries:
inputs = {"messages": [("user", prompt + query)]}
response = await agent.ainvoke(inputs, stream_mode="values", config=config)
print(response["messages"][-1].content)
```

To verify the agent's actions, you can examine the hotels table. You should
observe that the `booked` column for the `Hyatt Regency Basel` has changed
from `0` to `1`, indicating that the hotel has been successfully booked.
Additionally, the `checkin_date` and `checkout_date` have been updated to
`2024-04-10` and `2024-04-19` from `2024-04-02` and `2024-04-20`
respectively.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to combine this into a single file users can copy and hack on locally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This structure could help users understand and customize the steps involved.
However, we could upload the code and YAML files into the github repo and add a link for users to access them.

We could add a note at the beginning, like:

The code and configuration files used in this quickstart are available [here](link_to_files).

What do you think?

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@kurtisvg kurtisvg changed the title docs: added a quickstart for toolbox docs: add local quickstart Jan 17, 2025
```python
prompt = """
You're a helpful hotel assistant. You handle hotel searching, booking and
cancellations. When the user searches for a hotel, mention it's name, id,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cancellations. When the user searches for a hotel, mention it's name, id,
cancellations. When the user searches for a hotel, mention its name, id,

"""

queries = [
"Find hotels in Basel with Basel in it's name.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Find hotels in Basel with Basel in it's name.",
"Find hotels in Basel with Basel in its name.",

"Find hotels in Basel with Basel in it's name.",
"Can you book the Hilton Basel for me?",
"Oh wait, this is too expensive. Please cancel it and book the Hyatt Regency instead.",
"My check in dates would be from April 10, 2024 to April 19, 2024.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"My check in dates would be from April 10, 2024 to April 19, 2024.",
"My check-in dates would be from April 10, 2024 to April 19, 2024.",

@kurtisvg

Copy link
Copy Markdown
Collaborator

Superseded by #232

kurtisvg added a commit that referenced this pull request Jan 24, 2025
This is a continuation of #218, which add a local quickstart for running
Toolbox with Python and LangGraph.

---------

Co-authored-by: Twisha Bansal <twishabansal@google.com>
Co-authored-by: Anubhav Dhawan <anubhav756@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

🧨 Preview deployments removed.

@twishabansal twishabansal deleted the quickstart branch March 18, 2025 18:25
jeffreyrubi pushed a commit to jeffreyrubi/genai-toolbox that referenced this pull request Jun 7, 2025
This is a continuation of googleapis#218, which add a local quickstart for running
Toolbox with Python and LangGraph.

---------

Co-authored-by: Twisha Bansal <twishabansal@google.com>
Co-authored-by: Anubhav Dhawan <anubhav756@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants