mirror of
https://github.com/agentuniverse-ai/agentUniverse.git
synced 2026-02-09 01:59:19 +08:00
refactor: mv prompt_toolkit_app to third party dir
This commit is contained in:
@@ -42,7 +42,8 @@
|
||||
### 基本使用
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkit, PromptGenerationRequest
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkit,
|
||||
PromptGenerationRequest
|
||||
|
||||
# 初始化工具包
|
||||
toolkit = PromptToolkit()
|
||||
@@ -109,7 +110,7 @@ print(f"置信度: {result.confidence_score}")
|
||||
### PromptToolkitConfig
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkitConfig
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkitConfig
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:04
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -8,13 +8,13 @@
|
||||
"""Demo script for the prompt toolkit functionality."""
|
||||
|
||||
import asyncio
|
||||
from agentuniverse.prompt.prompt_toolkit import (
|
||||
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptComplexity
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import (
|
||||
PromptToolkit,
|
||||
PromptToolkitConfig,
|
||||
PromptGenerationRequest
|
||||
)
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
|
||||
|
||||
async def demo_prompt_generation():
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:04
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:04
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:04
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:04
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -8,12 +8,11 @@
|
||||
"""Prompt generation action for the prompt toolkit demo."""
|
||||
|
||||
from typing import Dict, Any, Optional
|
||||
from agentuniverse.prompt.prompt_toolkit import (
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import (
|
||||
PromptToolkit,
|
||||
PromptToolkitConfig,
|
||||
PromptGenerationRequest
|
||||
)
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.agent.action.tool.tool import Tool
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
# @FileName: prompt_optimization_action.py
|
||||
"""Prompt optimization action for the prompt toolkit demo."""
|
||||
|
||||
from typing import Dict, Any, Optional, List
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkit
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from typing import Dict, Any
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkit
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
from agentuniverse.agent.action.tool.tool import Tool
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"""Scenario analysis action for the prompt toolkit demo."""
|
||||
|
||||
from typing import Dict, Any, Optional
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkit
|
||||
from agentuniverse.prompt.scenario_analyzer import ScenarioAnalyzer
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkit
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.scenario_analyzer import ScenarioAnalyzer
|
||||
from agentuniverse.agent.action.tool.tool import Tool
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ PromptToolkit
|
||||
### 基本使用
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkit, PromptGenerationRequest
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkit, PromptGenerationRequest
|
||||
|
||||
# 初始化工具包
|
||||
toolkit = PromptToolkit()
|
||||
@@ -80,7 +80,7 @@ print(f"生成的prompt: {result.generated_prompt}")
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy
|
||||
|
||||
# 创建要优化的prompt
|
||||
prompt = AgentPromptModel(
|
||||
@@ -100,7 +100,7 @@ print(f"优化结果: {result.optimized_prompt}")
|
||||
### 场景分析
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.scenario_analyzer import ScenarioAnalyzer
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.scenario_analyzer import ScenarioAnalyzer
|
||||
|
||||
analyzer = ScenarioAnalyzer()
|
||||
result = analyzer.analyze_scenario("我需要一个数据分析助手")
|
||||
@@ -147,9 +147,9 @@ print(f"推荐场景: {result.recommended_scenario}")
|
||||
### PromptToolkitConfig
|
||||
|
||||
```python
|
||||
from agentuniverse.prompt.prompt_toolkit import PromptToolkitConfig
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import PromptToolkitConfig
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy
|
||||
|
||||
config = PromptToolkitConfig(
|
||||
enable_auto_optimization=True, # 启用自动优化
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:06
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -9,22 +9,13 @@
|
||||
|
||||
from typing import Dict, List, Optional, Any, Tuple
|
||||
from dataclasses import dataclass
|
||||
from agentuniverse.prompt.prompt_generator import (
|
||||
PromptGenerator,
|
||||
PromptScenario,
|
||||
PromptComplexity,
|
||||
ScenarioContext
|
||||
)
|
||||
from agentuniverse.prompt.prompt_optimizer import (
|
||||
PromptOptimizer,
|
||||
OptimizationStrategy,
|
||||
OptimizationResult
|
||||
)
|
||||
from agentuniverse.prompt.scenario_analyzer import (
|
||||
ScenarioAnalyzer,
|
||||
ScenarioAnalysisResult
|
||||
)
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptScenario, \
|
||||
PromptComplexity, PromptGenerator
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy, \
|
||||
OptimizationResult, PromptOptimizer
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.scenario_analyzer import ScenarioAnalysisResult, \
|
||||
ScenarioAnalyzer
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -12,7 +12,7 @@ import json
|
||||
from typing import Dict, List, Optional, Tuple, Any, Set
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from agentuniverse.prompt.prompt_generator import ScenarioContext, PromptScenario, PromptComplexity
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import ScenarioContext, PromptScenario, PromptComplexity
|
||||
|
||||
|
||||
class ContextType(Enum):
|
||||
@@ -0,0 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
# -*- coding:utf-8 -*-
|
||||
|
||||
# @Time : 2025/10/31 12:05
|
||||
# @Author : jerry.zzw
|
||||
# @Email : jerry.zzw@antgroup.com
|
||||
# @FileName: __init__.py.py
|
||||
@@ -8,15 +8,9 @@
|
||||
"""Unit tests for prompt generator module."""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
from agentuniverse.prompt.prompt_generator import (
|
||||
PromptGenerator,
|
||||
PromptScenario,
|
||||
PromptComplexity,
|
||||
ScenarioContext,
|
||||
PromptOptimizationResult
|
||||
)
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import ScenarioContext, \
|
||||
PromptGenerator, PromptScenario, PromptComplexity
|
||||
|
||||
|
||||
class TestPromptGenerator(unittest.TestCase):
|
||||
@@ -8,16 +8,9 @@
|
||||
"""Unit tests for prompt optimizer module."""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
from agentuniverse.prompt.prompt_optimizer import (
|
||||
PromptOptimizer,
|
||||
OptimizationStrategy,
|
||||
OptimizationRule,
|
||||
PromptQualityMetric,
|
||||
QualityScore,
|
||||
OptimizationResult
|
||||
)
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import PromptOptimizer, \
|
||||
OptimizationResult, OptimizationStrategy, OptimizationRule, QualityScore, PromptQualityMetric
|
||||
|
||||
|
||||
class TestPromptOptimizer(unittest.TestCase):
|
||||
@@ -8,15 +8,17 @@
|
||||
"""Unit tests for prompt toolkit module."""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
from agentuniverse.prompt.prompt_toolkit import (
|
||||
from unittest.mock import Mock
|
||||
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptScenario, \
|
||||
PromptComplexity
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_toolkit import (
|
||||
PromptToolkit,
|
||||
PromptToolkitConfig,
|
||||
PromptGenerationRequest,
|
||||
PromptToolkitResult
|
||||
)
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.prompt.prompt_optimizer import OptimizationStrategy
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
|
||||
|
||||
@@ -8,16 +8,11 @@
|
||||
"""Unit tests for scenario analyzer module."""
|
||||
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
from agentuniverse.prompt.scenario_analyzer import (
|
||||
ScenarioAnalyzer,
|
||||
ContextType,
|
||||
AnalysisConfidence,
|
||||
ExtractedContext,
|
||||
ScenarioAnalysisResult
|
||||
)
|
||||
from agentuniverse.prompt.prompt_generator import PromptScenario, PromptComplexity
|
||||
from agentuniverse.prompt.prompt_model import AgentPromptModel
|
||||
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.prompt_generator import PromptScenario, \
|
||||
PromptComplexity
|
||||
from examples.third_party_examples.apps.prompt_toolkit_app.prompt.scenario_analyzer import ScenarioAnalyzer, \
|
||||
ScenarioAnalysisResult, ExtractedContext, ContextType, AnalysisConfidence
|
||||
|
||||
|
||||
class TestScenarioAnalyzer(unittest.TestCase):
|
||||
Reference in New Issue
Block a user