Skip to content

Commit

Permalink
Merge pull request #2153 from solliancenet/cj-dalle-content-artifact
Browse files Browse the repository at this point in the history
Improve the generation of content artifacts by the DALL-E tool
  • Loading branch information
joelhulen authored Jan 23, 2025
2 parents dd28654 + e3179e9 commit efd8ba8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"cwd" : "${workspaceFolder}/src/python/LangChainAPI/app",
"env": {
"PYTHONPATH": "${workspaceFolder}/src/python/LangChainAPI;${workspaceFolder}/src/python/PythonSDK;d:/repos/fllm/foundationallm/src/python/PythonSDK;",
"FOUNDATIONALLM_CONTEXT": "DEBUG"
"FOUNDATIONALLM_CONTEXT": "DEBUG",
"FOUNDATIONALLM_APP_CONFIGURATION_URI": "https://appcs-l43jljq2i5ox6.azconfig.io"
},
"args": ["main:app","--reload", "--port", "8765"],
"python": "${workspaceFolder}/src/python/LangChainAPI/env/Scripts/python.exe"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DALLEImageGenerationTool(FoundationaLLMToolBase):
Supports only Azure Identity authentication.
"""
args_schema: Type[BaseModel] = DALLEImageGenerationToolInput

def __init__(self, tool_config: AgentTool, objects: dict, user_identity:UserIdentity, config: Configuration):
""" Initializes the DALLEImageGenerationTool class with the tool configuration,
exploded objects collection, user identity, and platform configuration. """
Expand Down Expand Up @@ -105,10 +105,16 @@ async def _arun(self,
)
content_artifacts = [
ContentArtifact(
id=image_data.url,
title=image_data.revised_prompt,
id=self.tool_config.name,
title=self.tool_config.name,
source='tool',
filepath=image_data.url,
type='image'
type='image',
metadata = {
'tool_name': self.tool_config.name,
'tool_input': prompt,
'revised_tool_input': image_data.revised_prompt
}
)
for image_data in result.data
if image_data.revised_prompt and image_data.url
Expand Down

0 comments on commit efd8ba8

Please sign in to comment.