Skip to content

ConversableAgent "send" function "context" question #458

Answered by JieyuZ2
bonadio asked this question in Q&A
Discussion options

You must be logged in to vote

The example is to show how to use the context mechanism. In general, the context mechanism allows you to change any user message in the conversation history. For example, the context could be

def content_function(use_b):
    if use_b:
        return str_a + str_b
    else:
        return str_a  

Then, the first message you send to the model could be

{ "content": content_function, "context": { "use_b": True } }

At certain turn of the conversation, you want to switch the first message to str_a only, you can send

{ "content": "current message", "context": { "use_b": False } }

Then, when calling the LLM, the first message would be changed to str_a only. (note: when using chat LLMs, every t…

Replies: 3 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@bonadio
Comment options

Answer selected by bonadio
Comment options

You must be logged in to vote
7 replies
@JieyuZ2
Comment options

@zuoyifan132
Comment options

@JieyuZ2
Comment options

@sonichi
Comment options

@zuoyifan132
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants