Code Monkey home page Code Monkey logo

Comments (14)

sp6370 avatar sp6370 commented on August 22, 2024 3

@tanya-rai @Ankush-lastmile!
I would like to pick this up. Can I have some more context for the issue?

from aiconfig.

Ankush-lastmile avatar Ankush-lastmile commented on August 22, 2024 2

Hi @sp6370! Apologies for the delay in getting back to you.

Starting with the python sdk, you can find the current method definition of add_output method in schema.py

As you can see, this method currently accepts a single output. The goal is to extend its functionality to handle multiple outputs. A possible approach is to introduce a new method, add_outputs, which would be similar in design to add_output. However, instead of a single output, it would accept a list of outputs. This method would then iterate over the list, utilizing the existing add_output method for each individual item.

I also notice a typo in the docstring, feel free to fix that up as well!

Looking forward to your thoughts and contributions on this! Please feel free to reach out if you have any questions or need further clarification.

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024 1

@Ankush-lastmile Any context on this?

from aiconfig.

Ankush-lastmile avatar Ankush-lastmile commented on August 22, 2024 1

Hey @sp6370, thanks for following up on this! I apologize for the delay. I've been tied up with a few other tasks. I'll make sure to provide you with the necessary context by the eod so you can start working on the issue. Thanks for your patience!

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024 1

Gotchya! Could you go ahead and create a issue for this and assign to me?
For the this issue, I will implement error handling as discussed above and raise the PR later today.

from aiconfig.

Ankush-lastmile avatar Ankush-lastmile commented on August 22, 2024 1

Could you go ahead and create a issue for this and assign to me?

Great! Created #529

I'm unable to assign your user to the issue for some reason at the moment, I'll try again later today. Looking forward to see your incoming pr's

from aiconfig.

tanya-rai avatar tanya-rai commented on August 22, 2024

Amazing! Yeah you should be able to. @Ankush-lastmile will provide some context today so you can get started.

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024

@Ankush-lastmile No worries! Please take your time.

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024

@Ankush-lastmile Could you elaborate what does not output do here?
https://github.com/lastmile-ai/aiconfig/blob/main/python/src/aiconfig/schema.py#L533

As per my understanding not output => User hasn't given anything to add to the prompt output. In that case, the function should just exit.

If it's empty then, why are we adding it to prompt.outputs?

Is there something that I am missing here?

from aiconfig.

Ankush-lastmile avatar Ankush-lastmile commented on August 22, 2024

Great observation, @sp6370! Your understanding seems correct – if 'output' is non-existent, it ideally shouldn't proceed to add anything to 'prompt.outputs'. Exiting the function or raising an error in this scenario would be a more appropriate action.

This does look like a potential oversight in our current implementation. Your eye for this detail is much appreciated! We should consider addressing this as part of the enhancement.

I Would recommend that we throw an exception here if Output is None, considering the fact that the Output object being passed in is not optional.

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024

@Ankush-lastmile I have sent you a message over Discord. Could you have a look at my request?

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024

I can't seem to get the add_output working.

import os
from aiconfig import AIConfigRuntime
import aiconfig_extension_gemini
from aiconfig.schema import ExecuteResult

os.environ['GOOGLE_API_KEY'] = ""

config = AIConfigRuntime(**{
    "name": "Exploring Gemini",
    "description": "",
    "schema_version": "latest",
    "metadata": {
        "models": {
            "gemini-pro": {
                "stream": True
            }
        },
        "default_model": "gemini-pro",
        "model_parsers": {}
    },
    "prompts": [
        {
            "name": "multilinguality",
            "input": "Can you teach me how to say duck in Mexican?",
            "metadata": {
                "model": "gemini-pro",
                "remember_chat_context": False
            }
        },
        {
            "name": "pronounciation",
            "input": "Can you explain how to pronounce the {{language}} one?",
            "metadata": {
                "model": "gemini-pro",
                "remember_chat_context": False
            }
        }
    ]
})

config.save("gemini_demo.aiconfig.json")

from aiconfig import CallbackManager, InferenceOptions
aiconfig = AIConfigRuntime.load("gemini_demo.aiconfig.json")

test_result = ExecuteResult(
    output_type="execute_result",
    execution_count=0.0,
    data={"role": "assistant", "content": "test output"},
    metadata={"finish_reason": "stop"},
)

aiconfig.add_output("multilinguality", test_result)

#aiconfig.delete_output("multilinguality")
await aiconfig.run("multilinguality")
output_text = aiconfig.get_output_text("multilinguality")
print(f'Gemini output: {output_text} \n')

Output:
image

Expected Output:
Gemini output: Pato test output

Can you let me know what I am missing here?

from aiconfig.

sp6370 avatar sp6370 commented on August 22, 2024

@Ankush-lastmile Any thoughts on How should I go about resolving this?

from aiconfig.

Ankush-lastmile avatar Ankush-lastmile commented on August 22, 2024

Any thoughts on How should I go about resolving this?

I noticed your approach with the run() method in the code. run() clears any previous outputs each time it's executed.

One thing you could try is adjusting the sequence of your operations. I would reccomend trying to either add the output after executing run or see if you can achieve your goal without using run at all initially.

Here's some pseudocode to illustrate:

output = ExecuteResult(...)
aiconfig.add_output("multilinguality", output)

print(aiconfig.get_prompt("multilinguality")) # print prompt. Should have new output added

This might help in better understanding how your changes are affecting the output. Give it a shot and let me know your findings!

from aiconfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.