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

partners: Add the additonnal kward 'context' for openai #28472

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lucasiscovici
Copy link
Contributor

Description

Add the additonnal kward 'context' for openai into convert_dict_to_message and convert_message_to_dict functions.

Details

In recent versions of the Azure OpenAI Chat With Your Data, a significant enhancement has been introduced with the addition of the "context" property into the response chat message.

The "context" property is added to the assistant's messages to provide extra information about the steps taken by Azure OpenAI while processing a request. This includes retrieved documents, citations, and other relevant metadata.

Chat message

The response assistant message schema inherits from the chat completions assistant chat message, and is extended with the property context.

Name Type Required Description
context Context False Represents the incremental steps performed by the Azure OpenAI On Your Data while processing the request, including the retrieved documents.

Context

Name Type Required Description
citations Citation[] False The data source retrieval result, used to generate the assistant message in the response. Clients can render references from the citations.
intent string False The detected intent from the chat history. Passing back the previous intent is no longer needed. Ignore this property.
all_retrieved_documents Retrieved documents[] False All the retrieved documents.

Citation

Name Type Required Description
content string True The content of the citation.
title string False The title of the citation.
url string False The URL of the citation.
filepath string False The file path of the citation.
chunk_id string False The chunk ID of the citation.

Retrieved documents

Name Type Required Description
search_queries string[] True The search queries used to retrieve the document.
data_source_index integer True The index of the data source.
original_search_score double True The original search score of the retrieved document.
rerank_score double False The rerank score of the retrieved document.
filter_reason string False Represents the rationale for filtering the document. If the document does not undergo filtering, this field will remain unset. Will be score if the document is filtered by original search score threshold defined by strictness. Will be rerank if the document is not filtered by original search score threshold, but is filtered by rerank score and top_n_documents.

@ccurme

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 3, 2024
Copy link

vercel bot commented Dec 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Dec 4, 2024 10:02am

Copy link
Collaborator

@baskaryan baskaryan left a comment

Choose a reason for hiding this comment

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

could we add an integration test

@ccurme ccurme added the needs test PR needs to be updated with tests label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs test PR needs to be updated with tests size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

3 participants