Skip to content
Open
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
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: end-of-file-fixer
files: (.*\.(py|md|rst|yaml|yml|json|ts|js|html|svelte|sh))$
Expand All @@ -26,7 +26,7 @@ repos:
args: [--fix=lf]

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
rev: v1.5.6
hooks:
- id: insert-license
files: (Dockerfile)$
Expand Down Expand Up @@ -74,12 +74,12 @@ repos:
name: Unused noqa

- repo: https://github.com/pycqa/isort
rev: 6.0.1
rev: 9.0.0a3
hooks:
- id: isort

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.7
rev: v1.7.8
hooks:
- id: docformatter
args: [
Expand All @@ -99,30 +99,30 @@ repos:
additional_dependencies:
- prettier@3.2.5

- repo: https://github.com/psf/black.git
rev: 25.1.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
hooks:
- id: black
files: (.*\.py)$

- repo: https://github.com/asottile/blacken-docs
rev: 1.19.1
rev: 1.20.0
hooks:
- id: blacken-docs
args: [--line-length=120, --skip-errors]
additional_dependencies:
- black==24.10.0

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
args: [-w]
additional_dependencies:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.15.20
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
36 changes: 15 additions & 21 deletions AvatarChatbot/ui/gradio/app_gradio_demo_avatarchatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def base64_to_int16(base64_string):


async def transcribe(audio_input, face_input, model_choice):
"""Input: mic audio; Output: ai audio, text, text"""
"""Input: mic audio; Output: ai audio, text, text."""
global ai_chatbot_url, chat_history, count
chat_history = ""
# Preprocess the audio
Expand Down Expand Up @@ -195,12 +195,11 @@ def initial_process(audio_input, face_input, model_choice):
gr.Markdown("<h1 style='font-size: 36px;'>A PyTorch and OPEA based AI Avatar Audio Chatbot</h1>")
with gr.Row():
with gr.Column(scale=8):
gr.Markdown(
"""
<p style='font-size: 24px;'>Welcome to our AI Avatar Audio Chatbot! This application leverages PyTorch and <strong>OPEA (Open Platform for Enterprise AI) v0.8</strong> to provide you with a human-like conversational experience. It's run on Intel® Gaudi® AI Accelerator and Intel® Xeon® Processor, with hardware and software optimizations.<br>
Please feel free to interact with the AI avatar by choosing your own avatar and talking into the mic.</p>
"""
)
gr.Markdown("""<p style='font-size: 24px;'>Welcome to our AI Avatar Audio Chatbot!

This application leverages PyTorch and <strong>OPEA (Open Platform for Enterprise AI) v0.8</strong> to provide you with a human-like conversational experience. It's run on Intel® Gaudi® AI Accelerator and Intel® Xeon® Processor, with hardware and software optimizations.<br>
Please feel free to interact with the AI avatar by choosing your own avatar and talking into the mic.</p>
""")
with gr.Column(scale=1):
# with gr.Row():
# gr.Markdown(f"""
Expand Down Expand Up @@ -285,45 +284,40 @@ def initial_process(audio_input, face_input, model_choice):
# Technical details
gr.Markdown("<hr>") # Divider
with gr.Row():
gr.Markdown(
"""
<p style='font-size: 24px;'>OPEA megaservice deployed: <br>
gr.Markdown("""<p style='font-size: 24px;'>OPEA megaservice deployed: <br>
<ul style='font-size: 24px;'>
<li><strong>AvatarChatbot</strong></li>
</ul></p>
<p style='font-size: 24px;'>OPEA microservices deployed:

<ul style='font-size: 24px;'>
<li><strong>ASR</strong> (service: opea/whisper-gaudi, model: openai/whisper-small)</li>
<li><strong>LLM 'text-generation'</strong> (service: opea/llm-textgen, model: Intel/neural-chat-7b-v3-3)</li>
<li><strong>TTS</strong> (service: opea/speecht5-gaudi, model: microsoft/speecht5_tts)</li>
<li><strong>Animation</strong> (service: opea/animation, model: wav2lip+gfpgan)</li>
</ul></p>
"""
)
""")
with gr.Row():
gr.Image("assets/img/flowchart.png", label="Megaservice Flowchart")
with gr.Row():
gr.Markdown(
"""
<p style='font-size: 24px;'>The AI Avatar Audio Chatbot is powered by the following Intel® AI software:<br>
"""<p style='font-size: 24px;'>The AI Avatar Audio Chatbot is powered by the following Intel® AI software:<br>
<ul style='font-size: 24px;'>
<li><strong>Intel Gaudi Software v1.17.0</strong></li>
<li><strong>PyTorch v2.3.1 (Eager mode + torch.compile) </strong></li>
<li><strong>HPU Graph</strong></li>
<li><strong>Intel Neural Compressor (INC)</strong></li>
</ul></p>
"""
</ul></p>"""
)

# Disclaimer
gr.Markdown("<hr>") # Divider
gr.Markdown("<h2 style='font-size: 24px;'>Notices & Disclaimers</h1>")
gr.Markdown(
"""<p style='font-size: 20px;'>Intel is committed to respecting human rights and avoiding complicity in human rights abuses.

See Intel's Global Human Rights Principles. Intel's products and software are intended only to be used in applications that do not cause or contribute to a violation of an internationally recognized human right.<br></p> <p style='font-size: 20px;'>© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.<br></p>
<p style='font-size: 20px;'>You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Intel products described herein. You agree to grant Intel a non-exclusive, royalty-free license to any patent claim thereafter drafted which includes subject matter disclosed herein.<br></p>
"""
<p style='font-size: 20px;'>Intel is committed to respecting human rights and avoiding complicity in human rights abuses. See Intel's Global Human Rights Principles. Intel's products and software are intended only to be used in applications that do not cause or contribute to a violation of an internationally recognized human right.<br></p>
<p style='font-size: 20px;'>© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.<br></p>
<p style='font-size: 20px;'>You may not use or facilitate the use of this document in connection with any infringement or other legal analysis concerning Intel products described herein. You agree to grant Intel a non-exclusive, royalty-free license to any patent claim thereafter drafted which includes subject matter disclosed herein.<br></p>
"""
)

# State transitions
Expand Down
2 changes: 1 addition & 1 deletion ChatQnA/docker_compose/amd/cpu/epyc/milvus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ dataCoord:
balanceSilentDuration: 300 # The duration after which the channel manager start background channel balancing
balanceInterval: 360 # The interval with which the channel manager check dml channel balance status
checkInterval: 1 # The interval in seconds with which the channel manager advances channel states
notifyChannelOperationTimeout: 5 # Timeout notifing channel operations (in seconds).
notifyChannelOperationTimeout: 5 # Timeout notifying channel operations (in seconds).
segment:
maxSize: 1024 # Maximum size of a segment in MB
diskSegmentMaxSize: 2048 # Maximum size of a segment in MB for collection which has Disk index
Expand Down
2 changes: 1 addition & 1 deletion ChatQnA/docker_compose/intel/cpu/xeon/milvus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ dataCoord:
balanceSilentDuration: 300 # The duration after which the channel manager start background channel balancing
balanceInterval: 360 # The interval with which the channel manager check dml channel balance status
checkInterval: 1 # The interval in seconds with which the channel manager advances channel states
notifyChannelOperationTimeout: 5 # Timeout notifing channel operations (in seconds).
notifyChannelOperationTimeout: 5 # Timeout notifying channel operations (in seconds).
segment:
maxSize: 1024 # Maximum size of a segment in MB
diskSegmentMaxSize: 2048 # Maximum size of a segment in MB for collection which has Disk index
Expand Down
2 changes: 0 additions & 2 deletions CodeGen/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def align_inputs(self, inputs, cur_node, runtime_graph, llm_parameters_dict, **k
Returns:
- inputs: The aligned inputs for the current node.
"""

# Check if the current service type is EMBEDDING
if self.services[cur_node].service_type == ServiceType.EMBEDDING:
# Store the input query for later use
Expand Down Expand Up @@ -100,7 +99,6 @@ def __init__(self, host="0.0.0.0", port=8000):

def add_remote_service(self):
"""Adds remote microservices to the service orchestrators and defines the flow between them."""

# Define the embedding microservice
embedding = MicroService(
name="embedding",
Expand Down
1 change: 0 additions & 1 deletion CogniwareIms/backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ async def root():
@app.get("/api/health")
async def health_check():
"""Comprehensive health check including all OPEA services."""

embedding_health = await embedding_service.health_check()
retrieval_health = await retrieval_service.health_check()
llm_health = await llm_service.health_check()
Expand Down
18 changes: 6 additions & 12 deletions CogniwareIms/backend/app/services/dbqna_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,21 @@ async def get_schema(self) -> Dict[str, Any]:
# Get table information
with engine.connect() as conn:
# Get all tables
tables_query = text(
"""
tables_query = text("""
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
"""
)
""")
tables = conn.execute(tables_query).fetchall()

for (table_name,) in tables:
# Get columns for each table
columns_query = text(
"""
columns_query = text("""
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = :table_name
ORDER BY ordinal_position
"""
)
""")
columns = conn.execute(columns_query, {"table_name": table_name}).fetchall()

schema["tables"][table_name] = {"columns": [{"name": col, "type": dtype} for col, dtype in columns]}
Expand Down Expand Up @@ -146,8 +142,7 @@ async def _get_product_inventory(self, sku: str, warehouse: str) -> Dict[str, An
try:
engine = self.get_engine()
with engine.connect() as conn:
query = text(
"""
query = text("""
SELECT
p.name as product,
p.sku,
Expand All @@ -159,8 +154,7 @@ async def _get_product_inventory(self, sku: str, warehouse: str) -> Dict[str, An
JOIN products p ON i.product_id = p.id
JOIN warehouses w ON i.warehouse_id = w.id
WHERE p.sku = :sku AND w.name = :warehouse
"""
)
""")

result = conn.execute(query, {"sku": sku, "warehouse": warehouse})
row = result.fetchone()
Expand Down
1 change: 0 additions & 1 deletion CogniwareIms/backend/app/services/interactive_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def _build_chat_messages(
user_role: str,
) -> List[Dict[str, str]]:
"""Build message list for LLM including context and history."""

# System prompt based on user role
role_prompts = {
"Consumer": "You are a helpful AI assistant for product research and PC building. Help users find products and make informed decisions.",
Expand Down
1 change: 0 additions & 1 deletion CogniwareIms/cogniwareims.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(self, host: str = "0.0.0.0", port: int = 8888):

def add_remote_service(self):
"""Configure and add microservices to the megaservice."""

# LLM Microservice - Text Generation (Intel neural-chat)
llm_service = MicroService(
name="llm",
Expand Down
2 changes: 0 additions & 2 deletions DeepResearchAgent/benchmark/accuracy/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ def run_benchmark(
Returns:
Tuple of (accuracy score, detailed results)
"""

results = []
total_questions = len(questions)
details = []
Expand All @@ -275,7 +274,6 @@ def run_benchmark(

def main():
"""Main function to run the benchmark."""

# Set up argument parser
parser = argparse.ArgumentParser(description="Run scoring with benchmarking options")
parser.add_argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ dataCoord:
balanceSilentDuration: 300 # The duration after which the channel manager start background channel balancing
balanceInterval: 360 # The interval with which the channel manager check dml channel balance status
checkInterval: 1 # The interval in seconds with which the channel manager advances channel states
notifyChannelOperationTimeout: 5 # Timeout notifing channel operations (in seconds).
notifyChannelOperationTimeout: 5 # Timeout notifying channel operations (in seconds).
segment:
maxSize: 1024 # Maximum size of a segment in MB
diskSegmentMaxSize: 2048 # Maximum size of a segment in MB for collection which has Disk index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ dataCoord:
balanceSilentDuration: 300 # The duration after which the channel manager start background channel balancing
balanceInterval: 360 # The interval with which the channel manager check dml channel balance status
checkInterval: 1 # The interval in seconds with which the channel manager advances channel states
notifyChannelOperationTimeout: 5 # Timeout notifing channel operations (in seconds).
notifyChannelOperationTimeout: 5 # Timeout notifying channel operations (in seconds).
segment:
maxSize: 1024 # Maximum size of a segment in MB
diskSegmentMaxSize: 2048 # Maximum size of a segment in MB for collection which has Disk index
Expand Down
3 changes: 1 addition & 2 deletions DocSum/ui/gradio/docsum_ui_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def read_url(self, url):
Returns:
str: The content of the website or an error message if the url is unsupported.
"""

self.page_content = ""

logger.info(">>> Reading url: %s", url)
Expand Down Expand Up @@ -91,7 +90,7 @@ def process_response(self, response):
("\n\ndata: b", ""),
("'\n\n", ""),
("'\n", ""),
('''\'"''', ""),
("""\'".""", ""),
]
for old, new in replacements:
cleaned_text = cleaned_text.replace(old, new)
Expand Down
2 changes: 2 additions & 0 deletions EdgeCraftRAG/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,14 @@ The CLI will display error messages from the API in JSON format. Network errors
## Tips

- Use `--help` with any command to see detailed help:

```bash
ecrag pipeline --help
ecrag pipeline create --help
```

- Pipe JSON output to other tools:

```bash
ecrag kb list | jq '.[]' | head -n 20
```
Expand Down
19 changes: 12 additions & 7 deletions EdgeCraftRAG/cli/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
# SPDX-License-Identifier: Apache-2.0

import json
import requests
from typing import Optional, Dict, Any
from typing import Any, Dict, Optional
from urllib.parse import urljoin

import requests


class EcragApiClient:
"""API client for Edge Craft RAG."""

def __init__(self, host: str = "http://localhost", server_port: int = 16010, mega_port: int = 16011):
"""Initialize the API client.

Args:
host: The host URL (default: http://localhost)
server_port: The server port (default: 16010)
Expand All @@ -21,10 +22,10 @@ def __init__(self, host: str = "http://localhost", server_port: int = 16010, meg
# Normalize host URL
if not host.startswith(("http://", "https://")):
host = f"http://{host}"

# Remove trailing slash if present
host = host.rstrip("/")

self.server_url = f"{host}:{server_port}"
self.mega_url = f"{host}:{mega_port}"

Expand Down Expand Up @@ -170,12 +171,16 @@ def delete_knowledge_base(self, kb_name: str) -> Dict[str, Any]:
def add_files_to_kb(self, kb_name: str, local_paths: list) -> Dict[str, Any]:
"""Add files to a knowledge base."""
url = urljoin(self.server_url, f"/v1/knowledge/{kb_name}/files")
return self._request("POST", url, json={"local_paths": local_paths}, headers={"Content-Type": "application/json"})
return self._request(
"POST", url, json={"local_paths": local_paths}, headers={"Content-Type": "application/json"}
)

def delete_files_from_kb(self, kb_name: str, local_paths: list) -> Dict[str, Any]:
"""Delete files from a knowledge base."""
url = urljoin(self.server_url, f"/v1/knowledge/{kb_name}/files")
return self._request("DELETE", url, json={"local_paths": local_paths}, headers={"Content-Type": "application/json"})
return self._request(
"DELETE", url, json={"local_paths": local_paths}, headers={"Content-Type": "application/json"}
)

# Experience Management
def get_experiences(self) -> Dict[str, Any]:
Expand Down
Loading
Loading