Skip to content

Commit

Permalink
fix context endpoint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ajar98 committed Aug 30, 2023
1 parent d0b5d72 commit a5e23a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/injecting-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ from fastapi import FastAPI
app = FastAPI()

@app.get("/my-context-endpoint")
def endpoint(request: Request):
if req.body.phone_number == "123":
def endpoint(phone_number: str):
if phone_number == "123":
return {"name": "Kian"}
elif req.body.phone_number == "456":
elif phone_number == "456":
return {"name": "Ajay"}
else:
return {}
```

This sets up a route at `http://localhost:8000/my-context-endpoint` that accepts `phone_number` as a URL param, i.e.
`http://localhost:8000/my-context-endpoint?phone_number=15555555555`.

Now, when either Kian or Ajay call the bot – the prompt will reflect the name of the person
the bot is talking to!

Expand Down

0 comments on commit a5e23a1

Please sign in to comment.