Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,25 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: hyoo-ru/mam_build@master2
- name: Checkout MAM
uses: actions/checkout@v4
with:
package: "raggu/web"
modules: 'front/app'
repository: hyoo-ru/mam
ref: master

- name: Checkout package
uses: actions/checkout@v4
with:
path: raggu/web

- name: Install MAM dependencies
run: |
npm install --omit=optional
# MAM calls convertCompilerOptionsFromJson; keep TypeScript on a version that exposes it.
npm install --save-exact --omit=optional typescript@6.0.3

- name: Build front app
run: npm start raggu/web/front/app

- name: Deploy main
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
Expand Down
64 changes: 64 additions & 0 deletions back/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,70 @@
# RAGU indexes
# Path to prebuilt RAGU indexes. Use either a directory with many indexes or one index directory.
RAGU_INDEXES_DIR=../../RAGU/indexes

# YandexGPT LLM
# Used for agent answers when YANDEX_API_KEY and YANDEX_FOLDER_ID are set.
# Takes priority over the OpenAI-compatible LLM fallback below.

# Yandex Cloud folder ID that owns the YandexGPT model.
YANDEX_FOLDER_ID=your-folder-id

# Yandex Cloud API key with access to Foundation Models.
YANDEX_API_KEY=your-api-key

# YandexGPT model name. Plain names are expanded to gpt://<YANDEX_FOLDER_ID>/<model>.
# A full gpt://... model URI can be used here too.
YANDEX_LLM_MODEL=yandexgpt-5-pro

# OpenAI-compatible Yandex Foundation Models endpoint.
YANDEX_BASE_URL=https://ai.api.cloud.yandex.net/v1

# OpenAI-compatible LLM fallback
# Used only when YandexGPT is not configured. Works with OpenAI, compatible gateways,
# or a local OpenAI-compatible chat endpoint.

# LLM API key. Prefer OPENAI_API_KEY; use LLM_API_KEY for non-OpenAI providers.
OPENAI_API_KEY=

# Alternative LLM API key name for OpenAI-compatible providers.
LLM_API_KEY=

# Chat model name. Prefer LLM_MODEL_NAME for provider-neutral configs.
LLM_MODEL_NAME=

# Alternative chat model name for OpenAI-style configs, for example gpt-4.1-mini.
OPENAI_MODEL=

# Base URL for the OpenAI-compatible LLM API, for example https://api.openai.com/v1.
OPENAI_BASE_URL=

# Alternative provider-neutral base URL for the OpenAI-compatible LLM API.
LLM_BASE_URL=

# Optional OpenAI project ID. Leave empty when the provider does not use projects.
OPENAI_PROJECT=

# Embeddings / vector search
# Search uses RAGU MixSearchEngine when EMBEDDER_MODEL_NAME and an OpenAI-compatible
# embedding endpoint are configured. Otherwise it falls back to local keyword search.

# Local OpenAI-compatible embedding endpoint.
LOCAL_EMBEDDER_URL=http://localhost:8001/v1

# Explicit embedding endpoint. Takes priority over LOCAL_EMBEDDER_URL.
EMBEDDER_BASE_URL=

# Embedding API key. Use "unused" for local endpoints that ignore API keys.
EMBEDDER_API_KEY=unused

# Embedding model served by the configured endpoint.
EMBEDDER_MODEL_NAME=intfloat/multilingual-e5-large

# Alternative embedding model name for OpenAI configs, for example text-embedding-3-large.
OPENAI_EMBEDDING_MODEL=

# Alternative embedding model name used by some OpenAI-compatible configs.
OPENAI_EMBEDDER_MODEL=

# Provider-neutral fallback embedding model name.
LLM_EMBEDDER_MODEL=
9 changes: 9 additions & 0 deletions back/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,21 @@ export YANDEX_FOLDER_ID=...
export YANDEX_API_KEY=...
export YANDEX_LLM_MODEL=yandexgpt-5-pro
export YANDEX_BASE_URL=https://ai.api.cloud.yandex.net/v1

export LOCAL_EMBEDDER_URL=http://localhost:8001/v1
export EMBEDDER_API_KEY=unused
export EMBEDDER_MODEL_NAME=intfloat/multilingual-e5-large
```

The LLM variables are optional. If they are missing, `/agent/messages` still
returns graph retrieval results with a clear fallback message instead of calling
an external model.

Search uses RAGU `MixSearchEngine` over the selected prebuilt index when
`EMBEDDER_MODEL_NAME` and an OpenAI-compatible embedding endpoint are configured.
The endpoint can be provided through `LOCAL_EMBEDDER_URL` or `EMBEDDER_BASE_URL`;
without it the API falls back to the lightweight local keyword retrieval.

## API

All application endpoints are under `/api/v1`.
Expand Down
4 changes: 2 additions & 2 deletions back/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@
"query_plan"
],
"title": "Engine",
"default": "local"
"default": "mix"
},
"top_k": {
"type": "integer",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"query_plan"
],
"title": "Default Engine",
"default": "local"
"default": "mix"
},
"available_engines": {
"items": {
Expand Down
2 changes: 2 additions & 0 deletions back/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ description = "FastAPI gateway contract for the RAGU web demo"
requires-python = ">=3.10"
dependencies = [
"fastapi>=0.115.0",
"graph-ragu>=0.0.3",
"openai>=2.32.0",
"pydantic>=2.8.0",
"ragu>=0.1.56",
"uvicorn[standard]>=0.30.0",
]

Expand Down
2 changes: 1 addition & 1 deletion back/src/ragu_web_api/schemas/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ChatMessage(APIModel):
class AgentRequest(APIModel):
message: str = Field(min_length=1, examples=["Who wrote the Norwegian anthem?"])
history: list[ChatMessage] = Field(default_factory=list)
engine: SearchEngine = "local"
engine: SearchEngine = "mix"
top_k: int = Field(default=8, ge=1, le=50)
rerank: bool = True
include_trace: bool = True
Expand Down
2 changes: 1 addition & 1 deletion back/src/ragu_web_api/schemas/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DatasetCard(APIModel):


class DatasetDetail(DatasetCard):
default_engine: SearchEngine = "local"
default_engine: SearchEngine = "mix"
available_engines: list[SearchEngine] = Field(
default_factory=lambda: ["local", "global", "naive", "mix", "query_plan"]
)
Expand Down
Loading
Loading