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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ db/*
caddy/caddy_config
caddy/caddy_data
tests/
grafana/*
grafana/*
4 changes: 2 additions & 2 deletions .github/scripts/wait_for_ci_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ ATTEMPT=1

while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
echo "Waiting for nilai to become healthy... API:[$API_HEALTH_STATUS] MODEL:[$MODEL_HEALTH_STATUS] NUC_API:[$NUC_API_HEALTH_STATUS] (Attempt $ATTEMPT/$MAX_ATTEMPTS)"

echo "===== Model Container Logs (last 50 lines) ====="
docker logs --tail 50 nilai_gpt_20b_gpu_1 2>&1
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"
echo "================================================="

sleep 30
API_HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' nilai-api 2>/dev/null)
MODEL_HEALTH_STATUS=$(docker inspect --format='{{.State.Health.Status}}' nilai_gpt_20b_gpu_1 2>/dev/null)
Expand Down
10 changes: 1 addition & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ repos:
- id: ruff # Runs Ruff's linter
exclude: "packages/verifier/" # Excludes the "packages/verifier/" directory from linting

# Second repository: Pyright for static type checking
- repo: local
hooks:
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
# Third repository: Local hooks (custom pre-commit checks)
- repo: local
hooks:
- id: pytest # Defines a local hook for running pytest
name: pytest # A human-readable name for the hook
entry: pytest # The command to execute
entry: uv run pytest # The command to execute
language: system # Uses the system-installed pytest instead of a virtual environment
types: [python] # Applies only to Python files
pass_filenames: false # Run pytest on the entire test suite rather than just changed files
Expand Down
2 changes: 1 addition & 1 deletion caddy/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
caddy_config/
caddy_data/
caddy_data/
2 changes: 1 addition & 1 deletion docker/api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ uv sync

EXPOSE 8080

CMD ["./launch.sh"]
CMD ["./launch.sh"]
2 changes: 1 addition & 1 deletion docker/vllm.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM vllm/vllm-openai:v0.11.2
FROM vllm/vllm-openai:v0.19.0

# # Specify model name and path during build
# ARG MODEL_NAME=llama_1b_cpu
Expand Down
2 changes: 1 addition & 1 deletion nilai-api/alembic/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Generic single-database configuration with an async dbapi.
Generic single-database configuration with an async dbapi.
6 changes: 3 additions & 3 deletions nilai-api/src/nilai_api/config/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

class AuthConfig(BaseModel):
auth_strategy: Literal["api_key", "jwt", "nuc"] = Field(
description="Authentication strategy"
default="api_key", description="Authentication strategy"
)
nilauth_trusted_root_issuers: List[str] = Field(
description="Trusted root issuers for nilauth"
default_factory=list, description="Trusted root issuers for nilauth"
)
credit_api_token: str = Field(description="Credit service API token")
credit_api_token: str = Field(default="", description="Credit service API token")
auth_token: Optional[str] = Field(
default=None, description="Auth token for e2e tests and development"
)
Expand Down
14 changes: 8 additions & 6 deletions nilai-api/src/nilai_api/config/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@


class DatabaseConfig(BaseModel):
user: str = Field(description="Database user")
password: str = Field(description="Database password")
host: str = Field(description="Database host")
port: int = Field(description="Database port")
db: str = Field(description="Database name")
user: str = Field(default="", description="Database user")
password: str = Field(default="", description="Database password")
host: str = Field(default="", description="Database host")
port: int = Field(default=5432, description="Database port")
db: str = Field(default="", description="Database name")


class DiscoveryConfig(BaseModel):
Expand All @@ -17,4 +17,6 @@ class DiscoveryConfig(BaseModel):


class RedisConfig(BaseModel):
url: str = Field(description="Redis URL for rate limiting")
url: str = Field(
default="redis://localhost:6379", description="Redis URL for rate limiting"
)
17 changes: 12 additions & 5 deletions nilai-api/src/nilai_api/config/nildb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@


class NilDBConfig(BaseModel):
nilchain_url: str = Field(..., description="The URL of the Nilchain")
nilauth_url: str = Field(..., description="The URL of the Nilauth")
nodes: List[str] = Field(..., description="The URLs of the Nildb nodes")
builder_private_key: str = Field(..., description="The private key of the builder")
collection: Uuid = Field(..., description="The ID of the collection")
nilchain_url: str = Field(default="", description="The URL of the Nilchain")
nilauth_url: str = Field(default="", description="The URL of the Nilauth")
nodes: List[str] = Field(
default_factory=list, description="The URLs of the Nildb nodes"
)
builder_private_key: str = Field(
default="", description="The private key of the builder"
)
collection: Uuid = Field(
default=Uuid("00000000-0000-0000-0000-000000000000"),
description="The ID of the collection",
)

@field_validator("nodes", mode="before")
@classmethod
Expand Down
2 changes: 1 addition & 1 deletion nilai-models/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ main() {
exit $?
}

main "$@"
main "$@"
13 changes: 5 additions & 8 deletions tests/e2e/test_chat_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,9 @@ def test_chat_completion_high_temperature(client):
assert response, "High temperature request should return a valid response"
assert response.choices, "Response should contain choices"
assert len(response.choices) > 0, "At least one choice should be present"
assert (
response.choices[0].message.content
or response.choices[0].message.reasoning_content
), "Response should contain content or reasoning_content"
assert response.choices[0].message.content or getattr(
response.choices[0].message, "reasoning", None
), "Response should contain content or reasoning"


def test_model_streaming_request_high_token(client):
Expand Down Expand Up @@ -689,10 +688,8 @@ def test_web_search(client, model, high_web_search_rate_limit):
assert len(response.choices) > 0, "Response should contain at least one choice"

content = response.choices[0].message.content
reasoning_content = getattr(response.choices[0].message, "reasoning_content", None)
assert content or reasoning_content, (
"Response should contain content or reasoning_content"
)
reasoning = getattr(response.choices[0].message, "reasoning", None)
assert content or reasoning, "Response should contain content or reasoning"

sources = getattr(response, "sources", None)
assert sources is not None, "Sources field should not be None"
Expand Down
6 changes: 2 additions & 4 deletions tests/e2e/test_chat_completions_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,9 @@ def test_web_search(client, model, high_web_search_rate_limit):

message = response_json["choices"][0].get("message", {})
content = message.get("content", "")
reasoning_content = message.get("reasoning_content", "")
reasoning = message.get("reasoning", "")

assert content or reasoning_content, (
"Response should contain content or reasoning_content"
)
assert content or reasoning, "Response should contain content or reasoning"

sources = response_json.get("sources")
if sources is not None:
Expand Down
Loading