Skip to content

Commit 1121795

Browse files
committed
fix some copy to have a problem statement, i think
1 parent 1108a01 commit 1121795

File tree

3 files changed

+492
-708
lines changed

3 files changed

+492
-708
lines changed

written/posts/2025-01-26.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Efficient API Design: Avoiding Costly External Requests
22

3+
<div role="alert" class="alert alert-info">
4+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
5+
<span>Previous article on <a href="/posts/2024-08-30">using Goja</a> provides context and underlying technical details.</span>
6+
</div>
7+
38
On a recent project, I built an API that leverages OpenStreetMap data, currently
4-
focusing on the United States and Canada. The API helps users locate
5-
neighborhoods they might want to live in. This journey involved several
6-
iterations of building a web application in read-only mode—a self-imposed
7-
constraint to avoid relying on external services. Everything operates within a
8-
contained environment, such as a container or VM.
9-
10-
This constraint led me to optimize an SQLite database containing OpenStreetMap
11-
data. While I’ve written about
12-
[compressing SQLite data for read-only databases](/posts/2024-07-02-optimizing-large-scale-openstreetmap-data-with-sqlite)
13-
in another blog post, the main challenge was enabling users to query and
14-
correlate geospatial data efficiently.
9+
focusing on the United States and Canada to search for points of interest near
10+
each other. The API endpoint for querying that data ran into problems of slow
11+
response times, both for querying and returning considerable data (megabyte
12+
payloads), with most of it often discarded on the client side. This post goes
13+
through the optimization process to have the user experience go from tens of
14+
seconds to a sub-second experience.
1515

1616
Initially, my front-end implementation included an endpoint that allowed users
1717
to query OpenStreetMap data in a manner similar to other OpenStreetMap systems.

written/potential/2025-01-29-prompt-creation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## Using LLMs to Convert Natural Language Queries into Structured Queries
1+
# Using LLMs to Convert Natural Language Queries into Structured Queries
22

3-
### Context
3+
## Context
44

55
Over the past year, I have been working on building an application platform that
66
supports searching through OpenStreetMap data via an API endpoint and an
@@ -27,7 +27,7 @@ it difficult to present the data in a human-readable and usable way. There can
2727
be tens of thousands, if not hundreds of thousands, of tags with multiple values
2828
for each.
2929

30-
### Initial Approach
30+
## Initial Approach
3131

3232
I wanted to take a different approach: Could I have something that converted a
3333
user's query, such as "grocery store," and mapped it to predefined tags?
@@ -48,7 +48,7 @@ to exclude mainstream coffee shops to find local businesses? This would require
4848
maintaining a list of coffee shops to exclude or providing an exclusion
4949
mechanism for users—making the interface complex.
5050

51-
### Experimenting with LLMs
51+
## Experimenting with LLMs
5252

5353
Given these limitations, I explored the possibility of using a Large Language
5454
Model (LLM) to process natural language queries and convert them into structured
@@ -80,7 +80,7 @@ Example query:
8080

8181
[Placeholder for an example with ChatGPT’s result.]
8282

83-
### Integrating LLMs into My Application
83+
## Integrating LLMs into My Application
8484

8585
With structured JSON working, I incorporated it into my application—a text box
8686
where users could describe their desired neighborhood, and it would return
@@ -106,7 +106,7 @@ I then asked ChatGPT to refine my prompt:
106106
107107
[Placeholder for shortened example of refined prompt.]
108108

109-
### Enhancing Query Accuracy
109+
## Enhancing Query Accuracy
110110

111111
To improve accuracy, I identified meaningful OpenStreetMap tags by researching
112112
community discussions and manually curating a list of about 50 high-value tags
@@ -127,15 +127,15 @@ Testing showed that responses were now more specific. For example:
127127
128128
[Placeholder for resulting query JSON.]
129129

130-
### Handling Geographic Areas
130+
## Handling Geographic Areas
131131

132132
To improve area selection, I extended the JSON output schema to include multiple
133133
areas. Instead of requiring users to select one state, I allowed descriptions
134134
like "Southwestern states" to infer multiple areas.
135135

136136
[Placeholder for a query that includes southwestern states.]
137137

138-
### Optimizing Performance
138+
## Optimizing Performance
139139

140140
While my implementation worked, optimizations were necessary:
141141

@@ -161,7 +161,7 @@ While my implementation worked, optimizations were necessary:
161161
characters.
162162
- This prevented excessive API costs and safeguarded against abuse.
163163

164-
### Conclusion
164+
## Conclusion
165165

166166
By integrating OpenStreetMap data with LLMs, I enabled users to query geospatial
167167
data using natural language. The system supports filtering, distance

0 commit comments

Comments
 (0)