prompt-caller 0.1.2__tar.gz → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prompt_caller
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: This package is responsible for calling prompts in a specific format. It uses LangChain and OpenAI API
5
5
  Home-page: https://github.com/ThiNepo/prompt-caller
6
6
  Author: Thiago Nepomuceno
@@ -8,6 +8,7 @@ from jinja2 import Template
8
8
  from langchain_core.tools import tool
9
9
  from langchain_core.messages import HumanMessage, SystemMessage, ToolMessage
10
10
  from langchain_openai import ChatOpenAI
11
+ from langchain_google_genai import ChatGoogleGenerativeAI
11
12
  from PIL import Image
12
13
  from pydantic import BaseModel, Field, create_model
13
14
 
@@ -50,6 +51,14 @@ class PromptCaller:
50
51
 
51
52
  return elements
52
53
 
54
+ def _createChat(self, configuration):
55
+ if configuration.get("model") is not None and configuration.get(
56
+ "model"
57
+ ).startswith("gemini"):
58
+ return ChatGoogleGenerativeAI(**configuration)
59
+ else:
60
+ return ChatOpenAI(**configuration)
61
+
53
62
  def getImageBase64(self, url: str) -> str:
54
63
  response = requests.get(url)
55
64
  response.raise_for_status()
@@ -119,7 +128,7 @@ class PromptCaller:
119
128
  output = configuration.get("output")
120
129
  configuration.pop("output")
121
130
 
122
- chat = ChatOpenAI(**configuration)
131
+ chat = self._createChat(configuration)
123
132
 
124
133
  if output:
125
134
  dynamicModel = self.createPydanticModel(output)
@@ -146,7 +155,7 @@ class PromptCaller:
146
155
  message.content += "\nOnly use the tool DynamicModel when providing an output call."
147
156
  break
148
157
 
149
- chat = ChatOpenAI(**configuration)
158
+ chat = self._createChat(configuration)
150
159
 
151
160
  # Register the tools
152
161
  if tools is None:
@@ -161,7 +170,7 @@ class PromptCaller:
161
170
  tools.extend([output])
162
171
  tools_dict[output.__name__.lower()] = output
163
172
  elif dynamicOutput:
164
- dynamicModel = self.createPydanticModel(output)
173
+ dynamicModel = self.createPydanticModel(dynamicOutput)
165
174
 
166
175
  tools.extend([dynamicModel])
167
176
  tools_dict["dynamicmodel"] = dynamicModel
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prompt_caller
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: This package is responsible for calling prompts in a specific format. It uses LangChain and OpenAI API
5
5
  Home-page: https://github.com/ThiNepo/prompt-caller
6
6
  Author: Thiago Nepomuceno
@@ -35,7 +35,7 @@ class BdistWheelCommand(bdist_wheel):
35
35
 
36
36
  setuptools.setup(
37
37
  name="prompt_caller",
38
- version="0.1.2",
38
+ version="0.1.3",
39
39
  author="Thiago Nepomuceno",
40
40
  author_email="thiago@neps.academy",
41
41
  description="This package is responsible for calling prompts in a specific format. It uses LangChain and OpenAI API",
File without changes
File without changes
File without changes