# LLM Strategy and Implementation

### Background

We aim to provide the best experience for those seeking public health information on services and organizations offering them. Utilizing a [Large Language Model](https://en.wikipedia.org/wiki/Large_language_model), we hope to achieve chat and speech functionality to provide better contextual results and feedback to our users.

### Purpose of the document

This document serves as a comprehensive guide, outlining our strategic approach to implementing LLM.&#x20;

### Flow

We are optimizing our search functionality by adding an LLM layer between the client and the data on our knowledge graph. This layer would handle embedding and parsing the response retrieved. The ideal flow is:

* The client sends the request with the query value.
* The LLM layer embeds the query: turning it into a vector.
* Our algorithm compares the data in our knowledge graph, ordering based on relevance - distance between the vectors.
* The LLM layer converts the data back into natural language.
* The client displays the result to the user.

<figure><img src="/files/vfPEoAR18upw5qVtticA" alt=""><figcaption><p>Ideal flow of search request and response</p></figcaption></figure>

### Expected Outcome

* [ ] Have the LLM handle our search - providing better context for users
* [ ] Have Voice search and feedback implemented: using <https://elevenlabs.io/>
* [ ] Have a chatbot that can handle conversations based on data on our knowledge graph.

### Guide

We will be using the [Neo4j & LLM Fundamentals](https://graphacademy.neo4j.com/courses/llm-fundamentals/) course for the implementation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tech.socialsafety.net/llm-integration/llm-strategy-and-implementation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
