dhisana 0.0.1.dev30__tar.gz → 0.0.1.dev32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/PKG-INFO +1 -1
  2. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/setup.py +1 -1
  3. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/cache_output_tools.py +1 -0
  4. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/check_for_intent_signal.py +2 -2
  5. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/compose_cadence.py +2 -2
  6. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/compose_salesnav_query.py +4 -4
  7. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/compose_search_query.py +2 -2
  8. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/compose_three_step_workflow.py +3 -3
  9. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/compose_workflow.py +2 -2
  10. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/create_list_from_sales_navigator.py +2 -2
  11. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/create_smart_list.py +2 -2
  12. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/dataframe_tools.py +2 -2
  13. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_email.py +2 -2
  14. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_email_response.py +2 -2
  15. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_linkedin_connect_message.py +2 -2
  16. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_linkedin_response_message.py +4 -4
  17. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_structured_output_internal.py +2 -77
  18. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openai_assistant_and_file_utils.py +6 -6
  19. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openai_helpers.py +2 -2
  20. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/research_lead.py +3 -3
  21. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/PKG-INFO +1 -1
  22. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/README.md +0 -0
  23. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/pyproject.toml +0 -0
  24. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/setup.cfg +0 -0
  25. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/__init__.py +0 -0
  26. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/cli/__init__.py +0 -0
  27. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/cli/cli.py +0 -0
  28. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/cli/datasets.py +0 -0
  29. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/cli/models.py +0 -0
  30. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/cli/predictions.py +0 -0
  31. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/schemas/__init__.py +0 -0
  32. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/schemas/common.py +0 -0
  33. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/schemas/sales.py +0 -0
  34. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/ui/__init__.py +0 -0
  35. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/ui/components.py +0 -0
  36. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/__init__.py +0 -0
  37. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/agent_task.py +0 -0
  38. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/agent_tools.py +0 -0
  39. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/apollo_tools.py +0 -0
  40. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/assistant_tool_tag.py +0 -0
  41. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/built_with_api_tools.py +0 -0
  42. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/cache_output_tools_local.py +0 -0
  43. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/check_email_validity_tools.py +0 -0
  44. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/check_linkedin_url_validity.py +0 -0
  45. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/clay_tools.py +0 -0
  46. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/company_utils.py +0 -0
  47. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/composite_tools.py +0 -0
  48. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/domain_parser.py +0 -0
  49. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/enrich_lead_information.py +0 -0
  50. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/extract_email_content_for_llm.py +0 -0
  51. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/g2_tools.py +0 -0
  52. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_content.py +0 -0
  53. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/generate_flow.py +0 -0
  54. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/google_custom_search.py +0 -0
  55. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/google_workspace_tools.py +0 -0
  56. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/hubspot_clearbit.py +0 -0
  57. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/hubspot_crm_tools.py +0 -0
  58. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/instantly_tools.py +0 -0
  59. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/linkedin_crawler.py +0 -0
  60. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/lusha_tools.py +0 -0
  61. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openapi_spec_to_tools.py +0 -0
  62. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openapi_tool/__init__.py +0 -0
  63. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openapi_tool/api_models.py +0 -0
  64. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openapi_tool/convert_openai_spec_to_tool.py +0 -0
  65. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/openapi_tool/openapi_tool.py +0 -0
  66. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/proxy_curl_tools.py +0 -0
  67. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/python_function_to_tools.py +0 -0
  68. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/sales_navigator_crawler.py +0 -0
  69. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/salesforce_crm_tools.py +0 -0
  70. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/sendgrid_tools.py +0 -0
  71. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/serpapi_search_tools.py +0 -0
  72. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/trasform_json.py +0 -0
  73. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/web_download_parse_tools.py +0 -0
  74. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/workflow_code_model.py +0 -0
  75. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/utils/zoominfo_tools.py +0 -0
  76. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/workflow/__init__.py +0 -0
  77. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/workflow/agent.py +0 -0
  78. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/workflow/flow.py +0 -0
  79. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/workflow/task.py +0 -0
  80. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana/workflow/test.py +0 -0
  81. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/SOURCES.txt +0 -0
  82. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/dependency_links.txt +0 -0
  83. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/entry_points.txt +0 -0
  84. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/requires.txt +0 -0
  85. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/src/dhisana.egg-info/top_level.txt +0 -0
  86. {dhisana-0.0.1.dev30 → dhisana-0.0.1.dev32}/tests/test_agent_tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dhisana
3
- Version: 0.0.1.dev30
3
+ Version: 0.0.1.dev32
4
4
  Summary: A Python SDK for Dhisana AI Platform
5
5
  Home-page: https://github.com/dhisana-ai/dhisana-python-sdk
6
6
  Author: Admin
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='dhisana',
5
- version='0.0.1-dev30',
5
+ version='0.0.1-dev32',
6
6
  description='A Python SDK for Dhisana AI Platform',
7
7
  author='Admin',
8
8
  author_email='contact@dhisana.ai',
@@ -16,6 +16,7 @@ CONTAINER_NAME = "cacheoutputs"
16
16
 
17
17
  # Initialize the BlobServiceClient
18
18
  blob_service_client = BlobServiceClient.from_connection_string(AZURE_BLOB_CONNECTION_STRING)
19
+ logging.getLogger("azure").setLevel(logging.CRITICAL)
19
20
 
20
21
  # Ensure the container exists (if it already exists, an error is caught and ignored)
21
22
  try:
@@ -2,7 +2,7 @@ import logging
2
2
  from typing import Any, Dict, List, Optional, cast
3
3
 
4
4
  from pydantic import BaseModel
5
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
5
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
6
6
  from dhisana.utils.compose_search_query import (
7
7
  generate_google_search_queries,
8
8
  get_search_results_for_insights
@@ -72,7 +72,7 @@ async def check_for_intent_signal(
72
72
  logger.info("Scoring intent signal '%s' for lead: %s", intent_signal_type, lead.get("full_name", "Unknown"))
73
73
 
74
74
  # The helper returns (model_instance or None, status_str)
75
- response_any, status = await get_structured_output_with_o1(
75
+ response_any, status = await get_structured_output_internal(
76
76
  user_prompt,
77
77
  IntentSignalScoring,
78
78
  tool_config=tool_config
@@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
5
  from pydantic import BaseModel
6
6
 
7
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
7
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
8
8
  from dhisana.utils.workflow_code_model import WorkflowPythonCode
9
9
 
10
10
  # Initialize logger
@@ -132,7 +132,7 @@ async def generate_code_for_campaign_cadence(
132
132
  "workflow_python_code": "<the python code here>"
133
133
  }}
134
134
  """
135
- response, status = await get_structured_output_with_o1(
135
+ response, status = await get_structured_output_internal(
136
136
  user_prompt, WorkflowPythonCode, tool_config=tool_config
137
137
  )
138
138
  return response.model_dump(), status
@@ -2,10 +2,10 @@ import logging
2
2
  import os
3
3
  from typing import Any, Dict, List, Optional
4
4
 
5
- import openai # Remove if not required outside get_structured_output_with_o1
5
+ import openai # Remove if not required outside get_structured_output_internal
6
6
  from pydantic import BaseModel
7
7
 
8
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
8
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
9
9
 
10
10
  logger = logging.getLogger(__name__)
11
11
  logging.basicConfig(level=logging.INFO)
@@ -27,7 +27,7 @@ async def generate_salesnav_people_search_url(
27
27
  Generate a single LinkedIn Sales Navigator URL based on the user's plain-English
28
28
  description of filters and parameters or a provided Sales Navigator URL.
29
29
 
30
- This function leverages an LLM (via get_structured_output_with_o1) to parse
30
+ This function leverages an LLM (via get_structured_output_internal) to parse
31
31
  the user's requirements (e.g., connection degree, seniority, region, etc.)
32
32
  and build a properly encoded Sales Navigator people-search URL.
33
33
 
@@ -247,7 +247,7 @@ async def generate_salesnav_people_search_url(
247
247
  logger.info("Generating Sales Navigator people-search URL from description: '%s'", english_description)
248
248
 
249
249
  # 3. Call your structured-output helper
250
- response, status = await get_structured_output_with_o1(
250
+ response, status = await get_structured_output_internal(
251
251
  user_prompt,
252
252
  SalesNavQuery,
253
253
  tool_config=tool_config
@@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional
6
6
  import aiohttp
7
7
  from pydantic import BaseModel
8
8
 
9
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
9
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
10
10
  from dhisana.utils.cache_output_tools import cache_output, retrieve_output
11
11
 
12
12
  logger = logging.getLogger(__name__)
@@ -101,7 +101,7 @@ async def generate_google_search_queries(
101
101
  logger.info("Generating Google search queries from description: %s", english_description)
102
102
 
103
103
  # Call your structured-output helper
104
- response, status = await get_structured_output_with_o1(
104
+ response, status = await get_structured_output_internal(
105
105
  user_prompt,
106
106
  GoogleSearchQuery,
107
107
  tool_config=tool_config
@@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
5
  from pydantic import BaseModel
6
6
 
7
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
7
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
8
8
  from dhisana.utils.workflow_code_model import WorkflowPythonCode
9
9
 
10
10
  # Example imports: adapt paths to your actual modules
@@ -69,8 +69,8 @@ async def generate_three_step_workflow(
69
69
  {english_description}
70
70
  """
71
71
 
72
- # Use get_structured_output_with_o1 to parse LLM output into ThreeStepWorkflow
73
- response_obj, status = await get_structured_output_with_o1(
72
+ # Use get_structured_output_internal to parse LLM output into ThreeStepWorkflow
73
+ response_obj, status = await get_structured_output_internal(
74
74
  user_prompt,
75
75
  ThreeStepWorkflow,
76
76
  tool_config=tool_config
@@ -5,7 +5,7 @@ from typing import Any, Dict, List, Optional
5
5
  import openai
6
6
  from pydantic import BaseModel
7
7
 
8
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
8
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
9
9
  from dhisana.utils.agent_task import execute_task
10
10
  from dhisana.utils.compose_salesnav_query import generate_salesnav_people_search_url
11
11
  from dhisana.utils.check_for_intent_signal import check_for_intent_signal
@@ -191,7 +191,7 @@ async def custom_workflow(tool_config):
191
191
  Output is in valid JSON format.
192
192
  """
193
193
 
194
- response, status = await get_structured_output_with_o1(
194
+ response, status = await get_structured_output_internal(
195
195
  user_prompt, WorkflowPythonCode, tool_config=tool_config
196
196
  )
197
197
  return response.model_dump(), status
@@ -3,7 +3,7 @@ import logging
3
3
  from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
5
 
6
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1, get_structured_output_with_o1
6
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal, get_structured_output_internal
7
7
  from dhisana.utils.workflow_code_model import WorkflowPythonCode
8
8
 
9
9
  # Initialize logger
@@ -193,7 +193,7 @@ async def generate_sales_nav_list_workflow_code(
193
193
  """
194
194
 
195
195
  # Call the LLM
196
- response, status = await get_structured_output_with_o1(
196
+ response, status = await get_structured_output_internal(
197
197
  user_prompt, WorkflowPythonCode, tool_config=tool_config
198
198
  )
199
199
  return response.model_dump(), status
@@ -2,7 +2,7 @@ import json
2
2
  import logging
3
3
  from typing import Any, Dict, List, Optional, Tuple
4
4
 
5
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
5
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
6
6
  from dhisana.utils.workflow_code_model import WorkflowPythonCode
7
7
 
8
8
  # Initialize logger
@@ -149,7 +149,7 @@ async def generate_smart_list_creation_code(
149
149
  }}
150
150
  """
151
151
 
152
- response, status = await get_structured_output_with_o1(
152
+ response, status = await get_structured_output_internal(
153
153
  user_prompt, WorkflowPythonCode, tool_config=tool_config
154
154
  )
155
155
  return response.model_dump(), status
@@ -33,13 +33,13 @@ class PandasQuery(BaseModel):
33
33
 
34
34
 
35
35
  @assistant_tool
36
- async def get_structured_output(message: str, response_type, model: str = "gpt-4o"):
36
+ async def get_structured_output(message: str, response_type, model: str = "o3-mini"):
37
37
  """
38
38
  Asynchronously retrieves structured output from the OpenAI API based on the input message.
39
39
 
40
40
  :param message: The input message to be processed by the OpenAI API.
41
41
  :param response_type: The expected format of the response (e.g., JSON).
42
- :param model: The model to be used for processing the input message. Defaults to "gpt-4o".
42
+ :param model: The model to be used for processing the input message. Defaults to "o3-mini".
43
43
  :return: A tuple containing the parsed response and a status string ('SUCCESS' or 'FAIL').
44
44
  """
45
45
  try:
@@ -5,7 +5,7 @@ import aiohttp
5
5
  from pydantic import BaseModel
6
6
  from dhisana.schemas.sales import ContentGenerationContext, Lead, PromptEngineeringGuidance
7
7
  from dhisana.utils.assistant_tool_tag import assistant_tool
8
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1, get_structured_output_with_assistant_and_vector_store
8
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal, get_structured_output_with_assistant_and_vector_store
9
9
 
10
10
  # Define a model for email copy information
11
11
  class EmailCopy(BaseModel):
@@ -103,7 +103,7 @@ async def generate_personalized_email_copy(
103
103
  vector_store_id=email_context.external_openai_vector_store_id,
104
104
  tool_config=tool_config)
105
105
  else:
106
- response, status = await get_structured_output_with_o1(prompt, EmailCopy, tool_config=tool_config)
106
+ response, status = await get_structured_output_internal(prompt, EmailCopy, tool_config=tool_config)
107
107
 
108
108
  if status != 'SUCCESS':
109
109
  raise Exception("Error in generating the personalized email.")
@@ -6,7 +6,7 @@ from dhisana.schemas.sales import ContentGenerationContext
6
6
  from dhisana.utils.assistant_tool_tag import assistant_tool
7
7
  from dhisana.utils.generate_structured_output_internal import (
8
8
  get_structured_output_with_assistant_and_vector_store,
9
- get_structured_output_with_o1
9
+ get_structured_output_internal
10
10
  )
11
11
 
12
12
  # ---------------------------------------------------------------------------------------
@@ -114,7 +114,7 @@ async def generate_inbound_email_response_copy(
114
114
  tool_config=tool_config
115
115
  )
116
116
  else:
117
- response, status = await get_structured_output_with_o1(
117
+ response, status = await get_structured_output_internal(
118
118
  prompt=prompt,
119
119
  response_format=InboundEmailTriageResponse,
120
120
  tool_config=tool_config
@@ -3,7 +3,7 @@ from typing import Dict, List, Optional
3
3
  from pydantic import BaseModel
4
4
  from dhisana.schemas.sales import ContentGenerationContext
5
5
  from dhisana.utils.generate_structured_output_internal import (
6
- get_structured_output_with_o1,
6
+ get_structured_output_internal,
7
7
  get_structured_output_with_assistant_and_vector_store
8
8
  )
9
9
  from dhisana.utils.assistant_tool_tag import assistant_tool
@@ -93,7 +93,7 @@ async def generate_personalized_linkedin_message_copy(
93
93
  tool_config=tool_config
94
94
  )
95
95
  else:
96
- response, status = await get_structured_output_with_o1(
96
+ response, status = await get_structured_output_internal(
97
97
  prompt,
98
98
  LinkedInConnectMessage,
99
99
  tool_config=tool_config
@@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional
2
2
  from pydantic import BaseModel
3
3
  from dhisana.schemas.sales import ContentGenerationContext
4
4
  from dhisana.utils.generate_structured_output_internal import (
5
- get_structured_output_with_o1,
5
+ get_structured_output_internal,
6
6
  get_structured_output_with_assistant_and_vector_store
7
7
  )
8
8
  from dhisana.utils.assistant_tool_tag import assistant_tool
@@ -130,9 +130,9 @@ async def generate_linkedin_response_message_copy(
130
130
  tool_config=tool_config
131
131
  )
132
132
  else:
133
- response, status = await get_structured_output_with_o1(
134
- prompt=prompt,
135
- response_format=LinkedInTriageResponse,
133
+ response, status = await get_structured_output_internal(
134
+ prompt,
135
+ LinkedInTriageResponse,
136
136
  tool_config=tool_config
137
137
  )
138
138
 
@@ -36,7 +36,7 @@ async def get_structured_output_internal(message: str, response_type, tool_confi
36
36
  OPENAI_KEY = get_openai_access_token(tool_config)
37
37
  client = AsyncOpenAI(api_key=OPENAI_KEY)
38
38
  completion = await client.beta.chat.completions.parse(
39
- model="gpt-4o-2024-08-06",
39
+ model="o3-mini",
40
40
  messages=[
41
41
  {"role": "system", "content": "Extract structured content from input. Output is in JSON Format."},
42
42
  {"role": "user", "content": message},
@@ -136,79 +136,4 @@ async def get_structured_output_with_assistant_and_vector_store(prompt: str, res
136
136
  raise HTTPException(status_code=500, detail="An unexpected error occurred while processing your request.")
137
137
  finally:
138
138
  if assistant:
139
- await delete_assistant(assistant.id, tool_config)
140
-
141
-
142
- async def get_structured_output_with_o1(
143
- prompt: str,
144
- response_format,
145
- tool_config: Optional[List[Dict]] = None
146
- ) -> Tuple[Any, str]:
147
- """
148
- Gets structured output from the o1 model given a message, a response type,
149
- and optional tool configuration.
150
- """
151
- try:
152
- # Use the class name instead of serializing the class
153
- response_type_str = response_format.__name__
154
- message_hash = hashlib.md5(prompt.encode('utf-8')).hexdigest()
155
- response_type_hash = hashlib.md5(response_type_str.encode('utf-8')).hexdigest()
156
- cache_key = f"{message_hash}:{response_type_hash}"
157
- cached_response = cache_output_tools.retrieve_output(
158
- "get_structured_output_with_o1", cache_key
159
- )
160
- if cached_response is not None:
161
- parsed_cached_response = response_format.parse_raw(cached_response)
162
- return parsed_cached_response, 'SUCCESS'
163
-
164
- OPENAI_KEY = get_openai_access_token(tool_config)
165
- client = AsyncOpenAI(api_key=OPENAI_KEY)
166
- o1_response = await client.chat.completions.create(
167
- model="o1-mini",
168
- messages=[
169
- {"role": "user", "content": prompt}
170
- ]
171
- )
172
-
173
- o1_response_content = o1_response.choices[0].message.content
174
- response = await client.beta.chat.completions.parse(
175
- model="gpt-4o-mini",
176
- messages=[
177
- {
178
- "role": "user",
179
- "content": f"Given the following data, format it with the given response format: {o1_response_content}"
180
- }
181
- ],
182
- response_format=response_format,
183
- )
184
-
185
- response = response.choices[0].message
186
- if response.parsed:
187
- cache_output_tools.cache_output(
188
- "get_structured_output_with_o1",
189
- cache_key,
190
- response.parsed.json()
191
- )
192
- return response.parsed, 'SUCCESS'
193
- elif response.refusal:
194
- logging.warning("ERROR: Refusal response: %s", response.refusal)
195
- return response.refusal, 'FAIL'
196
-
197
- except LengthFinishReasonError as e:
198
- logging.error(f"Too many tokens: {e}")
199
- raise HTTPException(
200
- status_code=502,
201
- detail="The request exceeded the maximum token limit."
202
- )
203
- except OpenAIError as e:
204
- logging.error(f"OpenAI API error: {e}")
205
- raise HTTPException(
206
- status_code=502,
207
- detail="Error communicating with the OpenAI API."
208
- )
209
- except Exception as e:
210
- logging.error(f"Unexpected error: {e}")
211
- raise HTTPException(
212
- status_code=500,
213
- detail="An unexpected error occurred while processing your request."
214
- )
139
+ await delete_assistant(assistant.id, tool_config)
@@ -519,7 +519,7 @@ async def run_function_callback(
519
519
  client = AsyncOpenAI(api_key=openai_key)
520
520
  try:
521
521
  chat_response = await client.chat.completions.create(
522
- model="gpt-4o-2024-08-06",
522
+ model="o3-mini",
523
523
  messages=messages,
524
524
  tools=tools,
525
525
  response_format={"type": "json_object"},
@@ -548,7 +548,7 @@ async def run_function_callback_multiple(
548
548
  client = AsyncOpenAI(api_key=openai_key)
549
549
  try:
550
550
  chat_response = await client.chat.completions.create(
551
- model="gpt-4o-2024-08-06",
551
+ model="o3-mini",
552
552
  messages=messages,
553
553
  tools=tools,
554
554
  response_format={"type": "json_object"},
@@ -595,7 +595,7 @@ async def run_chat_completion_text(
595
595
  openai_key = get_openai_access_token(tool_config)
596
596
  client = AsyncOpenAI(api_key=openai_key)
597
597
  chat_response = await client.chat.completions.create(
598
- model="gpt-4o-2024-08-06",
598
+ model="o3-mini",
599
599
  messages=messages,
600
600
  temperature=0.0,
601
601
  max_tokens=max_tokens,
@@ -624,7 +624,7 @@ async def run_chat_completion(
624
624
  openai_key = get_openai_access_token(tool_config)
625
625
  client = AsyncOpenAI(api_key=openai_key)
626
626
  chat_response = await client.chat.completions.create(
627
- model="gpt-4o-2024-08-06",
627
+ model="o3-mini",
628
628
  messages=messages,
629
629
  tools=tools,
630
630
  response_format={"type": "json_object"},
@@ -676,7 +676,7 @@ async def run_chat_completion_json(
676
676
  openai_key = get_openai_access_token(tool_config)
677
677
  client = AsyncOpenAI(api_key=openai_key)
678
678
  chat_response = await client.chat.completions.create(
679
- model="gpt-4o-2024-08-06",
679
+ model="o3-mini",
680
680
  messages=messages,
681
681
  response_format={"type": "json_object"},
682
682
  temperature=0.0,
@@ -721,7 +721,7 @@ async def run_chat_completion_structured_output(
721
721
  openai_key = get_openai_access_token(tool_config)
722
722
  client = AsyncOpenAI(api_key=openai_key)
723
723
  chat_response = await client.beta.chat.completions.parse(
724
- model="gpt-4o-2024-08-06",
724
+ model="o3-mini",
725
725
  messages=messages,
726
726
  response_format=response_format,
727
727
  temperature=0.0,
@@ -328,7 +328,7 @@ async def process_agent_request(row_batch: List[Dict], workflow: Dict, custom_in
328
328
  name="AI Assistant",
329
329
  instructions=instructions,
330
330
  tools=[],
331
- model="gpt-4o-2024-08-06"
331
+ model="o3-mini"
332
332
  )
333
333
  thread = await client.beta.threads.create()
334
334
  parsed_outputs = []
@@ -952,7 +952,7 @@ async def get_function_call_arguments(input_text: str, function_name: str) -> Tu
952
952
 
953
953
  # Make the API call
954
954
  response = await client.beta.chat.completions.parse(
955
- model="gpt-4o-2024-08-06",
955
+ model="o3-mini",
956
956
  messages=[
957
957
  {"role": "system", "content": "Extract function arguments in JSON format."},
958
958
  {"role": "user", "content": prompt},
@@ -5,7 +5,7 @@
5
5
  from typing import Dict, List, Optional
6
6
  from pydantic import BaseModel
7
7
  from dhisana.utils.assistant_tool_tag import assistant_tool
8
- from dhisana.utils.generate_structured_output_internal import get_structured_output_with_o1
8
+ from dhisana.utils.generate_structured_output_internal import get_structured_output_internal
9
9
 
10
10
  # Define a model for lead research information
11
11
  class LeadResearchInformation(BaseModel):
@@ -54,7 +54,7 @@ async def research_lead_with_icp_ai(user_properties: dict, icp: str, instruction
54
54
  "icp_match_score": "Score of how well the lead matches the ICP (0-5). 0 no match, 5 perfect match."
55
55
  }}
56
56
  """
57
- response, status = await get_structured_output_with_o1(instructions, LeadResearchInformation, tool_config=tool_config)
57
+ response, status = await get_structured_output_internal(instructions, LeadResearchInformation, tool_config=tool_config)
58
58
  return response.model_dump()
59
59
 
60
60
 
@@ -114,5 +114,5 @@ async def research_lead_with_full_info_ai(user_properties: dict, instructions:st
114
114
  }}
115
115
 
116
116
  """
117
- response, status = await get_structured_output_with_o1(instructions, LeadResearchInformation, tool_config=tool_config)
117
+ response, status = await get_structured_output_internal(instructions, LeadResearchInformation, tool_config=tool_config)
118
118
  return response.model_dump()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: dhisana
3
- Version: 0.0.1.dev30
3
+ Version: 0.0.1.dev32
4
4
  Summary: A Python SDK for Dhisana AI Platform
5
5
  Home-page: https://github.com/dhisana-ai/dhisana-python-sdk
6
6
  Author: Admin
File without changes
File without changes