微信扫码
添加专属顾问
我要投稿
.01
.02
.03
.04
.05
pip install azure-ai-openai lotus-nlp pyodbc pandas
# Azure OpenAI SDK
from azure.identity import DefaultAzureCredential
from azure.ai.openai import OpenAIClient
# LOTUS Library
import lotus
# Database Libraries
import pyodbc
import pandas as pd
# Set up Azure OpenAI Client
endpoint = "https://your-openai-resource.openai.azure.com/"
credential = DefaultAzureCredential()
openai_client = OpenAIClient(endpoint=endpoint, credential=credential)
# Set up LOTUS with OpenAI LLM
llm = lotus.OpenAI(azure_openai_client=openai_client)
# Database Connection
conn = pyodbc.connect(
'DRIVER={ODBC Driver 17 for SQL Server};'
'SERVER=your_server;DATABASE=your_database;UID=your_username;PWD=your_password'
)```# Load data into a Pandas DataFrame
movies_df = pd.read_sql_query("SELECT * FROM movies", conn)
# Create a LOTUS table
movies_table = lotus.Table.from_dataframe(movies_df, name="movies", llm=llm)```# Apply semantic filter
filtered_movies = movies_table.sem_filter("genre is romance and is considered a classic")
# Sort and select top 5
top_movies = filtered_movies.sort_values(by="box_office", ascending=False).head(5)
print(top_movies[['title', 'box_office']])
# Load financial data
stocks_df = pd.read_sql_query("SELECT * FROM stocks", conn)
stocks_table = lotus.Table.from_dataframe(stocks_df, name="stocks", llm=llm)
# Apply semantic filter
filtered_stocks = stocks_table.sem_filter(
"sector is technology and revenue growth last quarter above 20% and P/E ratio below 15"
)
print(filtered_stocks[['company_name', 'revenue_growth', 'pe_ratio']])
.06
# Assuming patient_data_table is a LOTUS table
filtered_patients = patient_data_table.sem_filter(
"age between 50 and 60 and underwent Procedure X"
)
average_recovery = filtered_patients['recovery_time'].mean()
print(f"Average Recovery Time: {average_recovery} days")
# Assuming customers_table is a LOTUS table
high_value_customers = customers_table.sem_filter(
"purchases over $1,000 last month and high engagement"
)
print(high_value_customers[['customer_id', 'total_purchases', 'engagement_score']])
.07
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2026-01-09
Milvus 向量数据库实战:从零构建高性能 RAG 系统
2026-01-08
都有混合检索与智能路由了,谁还在给RAG赛博哭坟?
2026-01-06
当 Claude Code 连接 NotebookLM,个人 AI 终于有了“长期记忆”
2026-01-06
AI 总 “胡说八道”?分类法 + 本体论,让 AI 决策透明可追溯
2026-01-05
MegaRAG :用“多模态知识图谱”打破 RAG 的“次元壁”
2026-01-03
打造你的企业级智能文档问答系统——Everything plus RAG 实战指南
2026-01-02
LEANN:200GB 压到 6GB,笔记本跑 RAG 不是梦
2026-01-02
如何用NotebookLM,把枯燥的财报解读成精美的PPT?
2025-10-12
2025-12-04
2025-11-04
2025-10-31
2025-12-03
2025-11-13
2025-10-12
2025-10-16
2025-10-16
2025-11-13
2026-01-08
2026-01-02
2025-12-23
2025-12-21
2025-12-10
2025-11-23
2025-11-20
2025-11-19