Skip to content

Commit

Permalink
Create a new folder packages to put all python related packages: spar…
Browse files Browse the repository at this point in the history
…ql-llm and expasy-agent. The agent is built using LangGraph nodes, and can be deployed using langgraph-api or our custom API
  • Loading branch information
vemonet committed Jan 13, 2025
1 parent 6ab3469 commit ab76ad2
Show file tree
Hide file tree
Showing 63 changed files with 5,065 additions and 581 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
data/
__pycache__/
.*_cache
dist/
node_modules/
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
.env

# Python
.venv
dist/
data/
__pycache__/
*.egg-info/
.*_cache
.coverage
.langgraph_api/
uv.lock

# Data
data/
notebooks/*.csv
notebooks/*.txt
entities_embeddings*.csv
uv.lock

src/sparql_llm/webapp
packages/expasy-agent/src/expasy_agent/webapp
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ RUN pip install --upgrade pip
COPY . /app/
# COPY ./scripts/prestart.sh /app/

RUN pip install -e ".[chat,cpu]"
WORKDIR /app/packages/expasy-agent

ENV PYTHONPATH=/app
ENV MODULE_NAME=src.sparql_llm.api
RUN pip install -e ".[cpu]" "../sparql-llm"

ENV PYTHONPATH=/app/packages/expasy-agent
ENV MODULE_NAME=src.expasy_agent.api
# ENV VARIABLE_NAME=app
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ print("\n".join(issues))
4. Run the script to index the resources (SPARQL endpoints listed in config file):

```sh
docker compose run api python src/sparql_llm/index.py
docker compose run api python src/expasy_agent/index.py
```

> [!WARNING]
Expand Down
1 change: 1 addition & 0 deletions chat-with-context/demo/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 30 additions & 8 deletions chat-with-context/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,49 @@
title="Source code on GitHub"
class="px-4 py-2 m-1 rounded-lg hover:bg-gray-300 dark:hover:bg-slate-500"
>
<i data-feather="github"></i>
<img src="./github.svg" alt="GitHub logo" />
</button>
</a>
</nav>

<div class="text-center mb-5 prose max-w-6xl mx-auto pb-5 border-b">
<h2 class="text-xl font-semibold">
<div class="text-left text-xs mb-5 prose max-w-3xl mx-auto pb-5 border-b">
<h2 class="text-xl text-center font-semibold border-b">
Ask Expasy
<div
class="inline-block ml-3 px-3 py-1 bg-red-600 text-white text-sm font-semibold rounded-full justify-center items-center"
>
Beta
</div>
</h2>
<p class="border-t pt-5">
Assistant to navigate resources from the Swiss Institute of Bioinformatics. Particularly knowledgeable about
UniProt, OMA, Bgee, RheaDB, and SwissLipids. But still learning.
<p>
<strong>ExpasyGPT</strong> is reshaping how researchers explore life science data, streamlining searches across
the <a href="https://www.sib.swiss/">SIB Swiss Institute of Bioinformatics</a>’ databases (learn more
<a href="/about-chat">here</a>). This AI-driven tool is powered by metadata and example queries from SPARQL
endpoints like:
</p>
<ul style="list-style: inside;">
<li>
<a href="http://www.uniprot.org/uniprot/" target="_blank">UniProt</a>, an expertly curated database of
proteins
</li>
<li><a href="https://omabrowser.org/oma/home/" target="_blank">OMA</a>, the orthologous matrix</li>
<li><a href="https://www.bgee.org/" target="_blank">Bgee</a>, an expertly curated gene expression database</li>
<li>
<a href="https://www.rhea-db.org/" target="_blank">Rhea</a>, an expertly curated database of biochemical
reactions
</li>
<li>
<a href="http://www.swisslipids.org/#/" target="_blank">SwissLipids</a>, an expertly curated database of
lipids.
</li>
</ul>
<p>
As the service evolves, it will integrate additional endpoints from the
<a href="/search/SPARQL" target="_blank">SIB Knowledge Graph</a>.
</p>
<p>
Contact [email protected] if you have any feedback or suggestions. Questions asked here are stored for research
purposes, see the <a href="https://www.sib.swiss/privacy-policy">SIB privacy policy</a> for more information.
<strong>We value your input!</strong> For any questions or suggestions, feel free to reach out to the
<a href="/contact" target="_blank">Expasy helpdesk</a>.
</p>
</div>

Expand Down
47 changes: 36 additions & 11 deletions chat-with-context/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Chat with context dev</title>
<meta name="description" content="Chat with context development page" />
<!-- <link rel="icon" type="image/png" href="../demo/src/sib-logo.png" /> -->
<link rel="icon" type="image/png" href="./demo/sib-logo.png" />

<script type="module" src="./src/chat-with-context.tsx"></script>
<!-- <link href="./src/style.css" rel="stylesheet" /> -->
Expand Down Expand Up @@ -34,35 +34,60 @@
title="Source code on GitHub"
class="px-4 py-2 m-1 rounded-lg hover:bg-gray-300 dark:hover:bg-slate-500"
>
<i data-feather="github"></i>
<img src="./demo/github.svg" alt="GitHub logo" />
</button>
</a>
</nav>

<div class="text-center mb-5 prose max-w-6xl mx-auto pb-5 border-b">
<h2 class="text-xl font-semibold">
<div class="text-left text-sm mb-5 prose max-w-3xl mx-auto pb-5 border-b">
<h2 class="text-xl text-center font-semibold border-b pb-2">
Ask Expasy
<div
class="inline-block ml-3 px-3 py-1 bg-red-600 text-white text-sm font-semibold rounded-full justify-center items-center"
>
Beta
</div>
</h2>
<p class="border-t pt-5">
Assistant to navigate resources from the Swiss Institute of Bioinformatics. Particularly knowledgeable about
UniProt, OMA, Bgee, RheaDB, and SwissLipids. But still learning.
<p>
<strong>ExpasyGPT</strong> is reshaping how researchers explore life science data, streamlining searches across
the <a href="https://www.sib.swiss/">SIB Swiss Institute of Bioinformatics</a>’ databases (learn more
<a href="/about-chat">here</a>). This AI-driven tool is powered by metadata and example queries from SPARQL
endpoints like:
</p>
<ul style="list-style: inside;">
<li>
<a href="http://www.uniprot.org/uniprot/" target="_blank">UniProt</a>, an expertly curated database of
proteins
</li>
<li><a href="https://omabrowser.org/oma/home/" target="_blank">OMA</a>, the orthologous matrix</li>
<li><a href="https://www.bgee.org/" target="_blank">Bgee</a>, an expertly curated gene expression database</li>
<li>
<a href="https://www.rhea-db.org/" target="_blank">Rhea</a>, an expertly curated database of biochemical
reactions
</li>
<li>
<a href="http://www.swisslipids.org/#/" target="_blank">SwissLipids</a>, an expertly curated database of
lipids.
</li>
</ul>
<p>
As the service evolves, it will integrate additional endpoints from the
<a href="/search/SPARQL" target="_blank">SIB Knowledge Graph</a>.
</p>
<p>
Contact [email protected] if you have any feedback or suggestions. Questions asked here are stored for research
purposes, see the <a href="https://www.sib.swiss/privacy-policy">SIB privacy policy</a> for more information.
<strong>We value your input!</strong> For any questions or suggestions, feel free to reach out to the
<a href="/contact" target="_blank">Expasy helpdesk</a>.
</p>
</div>

<div class="flex-grow mx-5">
<!-- api="https://chat.expasy.org/" -->
<!-- api="http://localhost:8000/" -->
<!-- Our API: api="http://localhost:8000/" -->
<!-- LangGraph dev: api="http://localhost:2024/" -->
<!-- LangGraph prod: api="http://localhost:8123/" -->
<!-- LangServe: api="http://localhost:8001/langgraph/" -->
<chat-with-context
api="http://localhost:8000/"
api="http://localhost:2024/"
api-key="%EXPASY_API_KEY%"
examples="Which resources are available at the SIB?,How can I get the HGNC symbol for the protein P68871?,What are the rat orthologs of the human TP53?,Where is expressed the gene ACE2 in human?,Anatomical entities where the INS zebrafish gene is expressed and its gene GO annotations,List the genes in primates orthologous to genes expressed in the fruit fly eye"
></chat-with-context>
Expand Down
Loading

0 comments on commit ab76ad2

Please sign in to comment.