Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to get the output of a large model instead of through the response #1469

Closed
lwdnxu opened this issue Dec 11, 2024 · 8 comments
Closed

How to get the output of a large model instead of through the response #1469

lwdnxu opened this issue Dec 11, 2024 · 8 comments

Comments

@lwdnxu
Copy link

lwdnxu commented Dec 11, 2024

How to get the output of a large model instead of through the response

@lwdnxu
Copy link
Author

lwdnxu commented Dec 11, 2024

@dosubot
hello, How to return one or both of plot-string-number-dataframe at the same time?

Copy link

dosubot bot commented Dec 11, 2024

The codebase currently handles different output types such as plot, string, number, and dataframe by defining specific classes for each type. These classes inherit from a base class BaseOutputType and implement methods to validate the type and value of the output [1].

However, there is no specific function or method in the codebase that allows for the combination of different output types into a single response, nor are there examples or test cases demonstrating the simultaneous return of multiple output types [1].

If you need to return multiple output types simultaneously, you might consider creating a custom function or class that can handle multiple outputs by packaging them into a single response object or dictionary. This would involve modifying the existing structure to accommodate multiple types and ensuring that each type is correctly validated and formatted.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@lwdnxu
Copy link
Author

lwdnxu commented Dec 11, 2024

@dosubot

If I want to output both number and dataframe types, how can I ensure the consistency of the output? For example, is the number of dataframes consistent with the number?

Copy link

dosubot bot commented Dec 11, 2024

To ensure the consistency of outputs when dealing with both number and dataframe types, you would need to implement a mechanism that checks the relationship between these outputs. Here are some steps you could consider:

  1. Define a Structure: Create a custom structure or class that can hold both the number and dataframe outputs. This structure should include logic to ensure that the number corresponds to the number of dataframes or rows/columns in the dataframe, depending on your specific requirements.

  2. Validation Logic: Implement validation logic within this structure to check the consistency. For example, if the number represents the count of dataframes, ensure that the list of dataframes matches this count. If the number is supposed to represent a specific metric derived from the dataframe, validate that this metric is correctly calculated.

  3. Modify Existing Classes: If necessary, extend or modify the existing NumberOutputType and DataFrameOutputType classes to include methods that can validate their interdependence.

  4. Testing: Write test cases to ensure that your implementation correctly handles various scenarios, such as mismatched counts or incorrect calculations.

By implementing these steps, you can ensure that the number and dataframe outputs are consistent with each other.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@lwdnxu
Copy link
Author

lwdnxu commented Dec 11, 2024

@dosubot

I want to have the description variable when I get the result. What should I do? Now there is only type and value, and most of the time there is no description.

Copy link

dosubot bot commented Dec 11, 2024

To include a description variable in the output when it is often missing, you can modify the serialization methods to handle cases where the description is not provided. The existing code already includes checks for the presence of a description and adds it to the output if available. Here's how you can ensure that the description is included when available:

  1. CSV Serialization: The convert_df_to_csv method checks if df.description is not None and includes it in the output.

  2. SQL Serialization: The convert_df_sql_connector_to_str method also checks for df.description and includes it if present.

  3. JSON Serialization: The convert_df_to_json method includes the description in the JSON dictionary if it is available.

If the description is missing, the current implementation simply omits it from the output. To include a placeholder or a default value when the description is missing, you can modify the code to add a default description like this:

# Example modification for JSON serialization
df_info = {
    "name": df.name,
    "description": df.description if df.description is not None else "No description available",
    "type": (
        df.type
        if "is_direct_sql" in extras and extras["is_direct_sql"]
        else extras["type"]
    ),
}

This approach can be applied similarly to other serialization methods if you want to ensure that a description is always included, even if it's just a placeholder [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@lwdnxu
Copy link
Author

lwdnxu commented Dec 12, 2024

@dosubot
The following is the core code of the execution code. The type obtained is a single type object, including {"type":"plot"}. Now when I get the list through the code, it includes multiple type objects, such as [{"type":"plot"},{"type":"number"}], how should I modify the code?

result = self.execute_code(code_to_run, code_context)

Copy link

dosubot bot commented Dec 12, 2024

To modify the code so that it can handle a list of multiple type objects, such as [{"type":"plot"}, {"type":"number"}], you will need to adjust the logic in the execute_code method and any subsequent processing to accommodate multiple outputs. Here are some steps you can take:

  1. Modify execute_code Method: Update the execute_code method to return a list of results instead of a single result. This involves changing the return type and ensuring that the method can handle and process multiple outputs.

  2. Iterate Over Results: After executing the code, iterate over the list of results. For each result, determine its type and handle it accordingly. This might involve calling different processing functions based on the type (e.g., plot, number).

  3. Update Validation and Processing: Ensure that the validation and processing logic can handle multiple outputs. You might need to update the validation methods in the BaseOutputType subclasses to work with lists of results.

  4. Example Code:

    results = self.execute_code(code_to_run, code_context)
    for result in results:
        result_type = result.get("type")
        if result_type == "plot":
            # Handle plot type
            pass
        elif result_type == "number":
            # Handle number type
            pass
        # Add additional handling for other types as needed
  5. Testing: Test the modified code to ensure it correctly handles multiple output types and that each type is processed as expected.

By implementing these changes, you can modify the code to handle and process multiple type objects in a list format.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@sinaptik-ai sinaptik-ai locked and limited conversation to collaborators Dec 13, 2024
@gdcsinaptik gdcsinaptik converted this issue into discussion #1476 Dec 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant