Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: import Graph without position information #3203

Merged
merged 52 commits into from
Aug 7, 2024
Merged

Conversation

ogabrielluiz
Copy link
Contributor

This PR adds the possibility to add a flow generated without the use of the Langflow UI.

To test it run:

from langflow.graph import Graph
from langflow.components import helpers, inputs, models, outputs, prompts

session_id = "test_session_id"
template = """{context}

User: {user_message}
AI: """
memory_component = helpers.MemoryComponent()(session_id=session_id)
chat_input = inputs.ChatInput()
prompt_component = prompts.PromptComponent()(
    template=template, user_message=chat_input.message_response, context=memory_component.retrieve_messages_as_text
)
openai_component = models.OpenAIModelComponent()(
    input_value=prompt_component.build_prompt, max_tokens=100, temperature=0.1
)
chat_output = outputs.ChatOutput()(input_value=openai_component.text_response)

graph = Graph(chat_input, chat_output)
graph_json = graph.dumps()
with open("graph.json", "w") as f:
    f.write(graph_json)

Then paste it in the Langflow workspace.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Aug 5, 2024
Copy link
Contributor

github-actions bot commented Aug 5, 2024

Pull Request Validation Report

This comment is automatically generated by Conventional PR

Whitelist Report

Whitelist Active Result
Pull request is a draft and should be ignored
Pull request is made by a whitelisted user and should be ignored
Pull request is submitted by a bot and should be ignored
Pull request is submitted by administrators and should be ignored

Result

Pull request does not satisfy any enabled whitelist criteria. Pull request will be validated.

Validation Report

Validation Active Result
All commits in this pull request has valid messages
Pull request does not introduce too many changes
Pull request has a valid title
Pull request has mentioned issues
Pull request has valid branch name
Pull request should have a non-empty body

Result

Pull request satisfies all enabled pull request rules.

Last Modified at 05 Aug 24 20:11 UTC

@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Aug 5, 2024
Base automatically changed from feat/genjson2 to main August 5, 2024 21:00
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 5, 2024
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Aug 5, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 6, 2024
Copy link
Contributor

@anovazzi1 anovazzi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 6, 2024
- Added `getRightHandleId` function to generate the right handle ID for source handles.
- Added `getLeftHandleId` function to generate the left handle ID for target handles.
- These functions improve code readability and maintainability by encapsulating the logic for generating handle IDs.
ogabrielluiz and others added 19 commits August 7, 2024 10:08
…ne graph tests and emphasize error handling for unprepared graphs
…ackage-lock.json for better dependency management
…ent name if available, or fallback to class name
…able, ensuring accurate validation of graph structure
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 7, 2024
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 7, 2024
@ogabrielluiz ogabrielluiz merged commit 919073a into main Aug 7, 2024
50 checks passed
@ogabrielluiz ogabrielluiz deleted the feat/elkjslayout branch August 7, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants