Skip to content

Commit 3cb8e23

Browse files
committed
Revert "Merge pull request #14026 from TomeHirata/citation-supported-text"
This reverts commit afa6871, reversing changes made to 55186da.
1 parent dc61615 commit 3cb8e23

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

litellm/llms/anthropic/chat/handler.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,6 @@ def chunk_parser(self, chunk: dict) -> ModelResponseStream:
743743
)
744744

745745
text, tool_use = self._handle_json_mode_chunk(text=text, tool_use=tool_use)
746-
if type_chunk:
747-
provider_specific_fields["chunk_type"] = type_chunk
748746

749747
returned_chunk = ModelResponseStream(
750748
choices=[

litellm/llms/anthropic/chat/transformation.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -797,15 +797,7 @@ def extract_response_content(self, completion_response: dict) -> Tuple[
797797
if content.get("citations") is not None:
798798
if citations is None:
799799
citations = []
800-
citations.append(
801-
[
802-
{
803-
**citation,
804-
"supported_text": content.get("text", ""),
805-
}
806-
for citation in content["citations"]
807-
]
808-
)
800+
citations.append(content["citations"])
809801
if thinking_blocks is not None:
810802
reasoning_content = ""
811803
for block in thinking_blocks:

tests/llm_translation/test_anthropic_completion.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,6 @@ def test_anthropic_citations_api():
920920
citations = resp.choices[0].message.provider_specific_fields["citations"]
921921

922922
assert citations is not None
923-
if citations:
924-
citation = citations[0][0]
925-
assert "supported_text" in citation
926-
assert "cited_text" in citation
927-
assert "document_index" in citation
928-
assert "document_title" in citation
929-
assert "start_char_index" in citation
930-
assert "end_char_index" in citation
931923

932924

933925
def test_anthropic_citations_api_streaming():
@@ -963,11 +955,11 @@ def test_anthropic_citations_api_streaming():
963955
has_citations = False
964956
for chunk in resp:
965957
print(f"returned chunk: {chunk}")
966-
if provider_specific_fields := chunk.choices[0].delta.provider_specific_fields:
967-
if "citation" in provider_specific_fields:
968-
has_citations = True
969-
970-
assert "chunk_type" in provider_specific_fields
958+
if (
959+
chunk.choices[0].delta.provider_specific_fields
960+
and "citation" in chunk.choices[0].delta.provider_specific_fields
961+
):
962+
has_citations = True
971963

972964
assert has_citations
973965

0 commit comments

Comments
 (0)