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
4 changes: 2 additions & 2 deletions ai/generative-ai-service/hr-goal-alignment/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
**/__pycache__/
venv/
files/venv/
**/config.py
config.py
.DS_Store
data/
*.log
*.txt
!requirements.txt
3 changes: 2 additions & 1 deletion ai/generative-ai-service/hr-goal-alignment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ See [LICENSE](./LICENSE) for more details.

---

> ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.


## Disclaimer

ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
5 changes: 2 additions & 3 deletions ai/generative-ai-service/hr-goal-alignment/files/Org_Chart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
import streamlit as st
from urllib.parse import quote, unquote

Expand Down Expand Up @@ -100,7 +99,7 @@ def create_org_chart():
"""

# Display the chart with HTML component
st.components.v1.html(html_chart, height=520, scrolling=True) # type: ignore
st.components.v1.html(html_chart, height=520, scrolling=True)

# Show details section for selected employee
# ------------------------------------------------------------
Expand Down Expand Up @@ -182,5 +181,5 @@ def chip_style(val):
else "background-color:#f8d7da;font-weight:bold"
)

styled = goals_pretty.style.applymap(chip_style, subset=[LABEL_COL]) # type: ignore
styled = goals_pretty.style.applymap(chip_style, subset=[LABEL_COL])
st.dataframe(styled, use_container_width=True, hide_index=True)
1 change: 1 addition & 0 deletions ai/generative-ai-service/hr-goal-alignment/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The system integrates with Oracle Database and uses OCI's Generative AI models t
├── utils.py
├── requirements.txt
└── README.md
```

## Setup Instructions

Expand Down
3 changes: 1 addition & 2 deletions ai/generative-ai-service/hr-goal-alignment/files/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
import streamlit as st
from pathlib import Path

Expand Down Expand Up @@ -30,4 +29,4 @@


pg = st.navigation(pages)
pg.run()
pg.run()
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
# config_template.py

# === OCI Configuration ===
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
from typing import List, Dict, Optional
from langchain_community.vectorstores import OracleVS
import os
Expand All @@ -13,7 +12,6 @@
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_community.embeddings import OCIGenAIEmbeddings
from langchain_core.documents import Document
from langchain_community.vectorstores.utils import DistanceStrategy

# Use the project's config file
import config
Expand Down Expand Up @@ -62,7 +60,7 @@ def _initialize_vector_store(self) -> OracleVS:
client=self.db_conn, # Use the connection passed in __init__
embedding_function=self.embeddings, # Use the embeddings initialized in __init__
table_name=config.VECTOR_TABLE_NAME, # Use table name from project config
distance_strategy=DistanceStrategy.COSINE
distance_strategy="COSINE"
)

# LLM initialization removed.
Expand Down Expand Up @@ -169,3 +167,5 @@ def similarity_search(self, query: str, k: int = 5) -> List[Document]:
except Exception as e:
logger.error(f"Error during similarity search: {e}", exc_info=True)
return []


Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
import logging
import sys
import oracledb
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) 2025 Oracle and/or its affiliates.
import json
import logging
import sys
Expand Down Expand Up @@ -53,7 +52,8 @@ def recommend_courses(profile, feedback) -> dict:
model = get_llm_model()
response = {}
try:
response = model.with_structured_output(schema).invoke(
# Get raw output first for debugging
raw_output = model.invoke(
[
SystemMessage(content=prompt_sys),
HumanMessage(
Expand All @@ -63,10 +63,27 @@ def recommend_courses(profile, feedback) -> dict:
),
]
)
logger.info(f"Raw LLM response before parsing:\n{raw_output}")
# Now parse the structured output
result = model.with_structured_output(schema).invoke(
[
SystemMessage(content=prompt_sys),
HumanMessage(
content=prompt_user.format(
EMPLOYEE_PROFILE=profile, MANAGER_FEEDBACK=feedback
)
),
]
)
if result is None:
logger.warning("GenAI model response couldn't be parsed into the expected schema.")
logger.warning("Consider inspecting the raw output.")
else:
response = dict(result) if not isinstance(result, dict) else result
except Exception as e:
logger.error(f"Error during recommended_courses execution: {e}")

return response # type: ignore
logger.info(f"Returning response from recommend_courses: {response}")
return response



Expand All @@ -82,7 +99,7 @@ def classify_smart_goal(goal_description) -> dict:
except Exception as e:
logger.error(f"Error during recommended_courses execution: {e}")

return json.loads(response.content) # type: ignore
return json.loads(response.content)


prompt_sys = """
Expand Down Expand Up @@ -133,6 +150,58 @@ def classify_smart_goal(goal_description) -> dict:
DO NOT wrap your response in code blocks, backticks, or any other formatting. Return ONLY the raw JSON object itself.
"""


new_prompt_user = """
Based on the following information about an employee and their performance, recommend appropriate training courses.

**Employee Profile:**
{EMPLOYEE_PROFILE}

**Manager Feedback:**
{MANAGER_FEEDBACK}

Your task:

1. Identify exactly 3 skill-based focus areas for this employee to develop, prioritized according to:
- The most critical issues raised in the manager's feedback
- Then their job title and core responsibilities
- Then existing skills and experience level

2. For each focus area, recommend exactly 2 course titles that:
- Explicitly include difficulty level in the title using: "(Beginner)", "(Intermediate)", or "(Advanced)"
- Address the skill gap clearly
- Are appropriate for the employee's experience

**Output Format:**

Return ONLY a JSON object with a single key: `"recommended_courses"`
- This key must map to an object
- Each key in that object is a focus area (string)
- Each value is a list of exactly two course titles (strings)

**Example:**
{
"recommended_courses": {
"Strategic Communication": [
"Influential Communication for Technical Professionals (Intermediate)",
"Executive Presence and Presentation Skills (Advanced)"
],
"Technical Leadership": [
"Leading High-Performance Technical Teams (Intermediate)",
"Strategic Technical Decision Making (Advanced)"
],
"Project Estimation": [
"Fundamentals of Project Estimation (Beginner)",
"Advanced Techniques in Project Scoping and Estimation (Intermediate)"
]
}
}

⚠️ Do NOT include any explanations, markdown formatting, backticks, or extra text. Only return the raw JSON object as shown.
"""



prompt_user = """
Based on the following information about an employee and their performance, recommend appropriate training courses:

Expand Down
Loading