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

More support for cohere plus example #212

Merged
merged 31 commits into from
May 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6bc0b82
Adding handler for StreamedChatResponse_SearchResults
HowieG May 13, 2024
141406d
Renaming file to avoid package issues
HowieG May 15, 2024
38c666d
debug logging
siyangqiu May 15, 2024
e4de31a
logging
siyangqiu May 15, 2024
ad42bbe
new api v2
siyangqiu May 15, 2024
4aa1543
missed endpoint
siyangqiu May 15, 2024
673d471
working v2
siyangqiu May 16, 2024
91e83aa
update notebook
siyangqiu May 16, 2024
5287c86
Merge branch 'main' into v2-api
siyangqiu May 16, 2024
e0faa85
reduce max-wait-time to 5 seconds
siyangqiu May 16, 2024
87b3acf
rename to jwt
siyangqiu May 16, 2024
4be7b29
formatting logs
siyangqiu May 16, 2024
69c3829
Adding handler for StreamedChatResponse_SearchResults
HowieG May 13, 2024
5c8e1b1
Renaming file to avoid package issues
HowieG May 15, 2024
f37dd98
example
HowieG May 16, 2024
77286fe
Merge branch 'cohere-extra' of https://github.com/AgentOps-AI/agentop…
HowieG May 16, 2024
5a7b087
fix
HowieG May 16, 2024
20a26ba
fix
HowieG May 16, 2024
1b9a0e8
WIP
HowieG May 16, 2024
3507160
Merge remote-tracking branch 'origin/v2-api' into cohere-extra
HowieG May 16, 2024
bec28bc
WIP. Recording an ActionEvent
HowieG May 16, 2024
20b54a6
Added support for citations
HowieG May 16, 2024
8f0060e
citations now have documents
HowieG May 16, 2024
0dabfca
Touched up example
HowieG May 16, 2024
dd47790
Better example
HowieG May 16, 2024
3fc54ac
Fixed example
HowieG May 16, 2024
4685a12
fixed example
HowieG May 16, 2024
43d9115
One last commit
HowieG May 16, 2024
155b8ad
cleanup
HowieG May 16, 2024
2a40607
Revert "Merge remote-tracking branch 'origin/v2-api' into cohere-extra"
HowieG May 16, 2024
4cb11bc
cleanup
HowieG May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
citations now have documents
  • Loading branch information
HowieG committed May 16, 2024
commit 8f0060edbe2fb9143239d960f12323a44d62fafa
6 changes: 6 additions & 0 deletions agentops/llm_tracker.py
Original file line number Diff line number Diff line change
@@ -283,12 +283,18 @@ def handle_stream_chunk(chunk):
action_event.end_timestamp = get_ISO_time()

# StreamedChatResponse_CitationGeneration = ActionEvent
documents = {doc['id']: doc for doc in chunk.response.documents}
citations = chunk.response.citations
for citation in citations:
citation_id = f"{citation.start}.{citation.end}"
if citation_id in self.action_events:
action_event = self.action_events[citation_id]
citation_dict = citation.dict()
# Replace document_ids with the actual documents
citation_dict['documents'] = [documents[doc_id]
for doc_id in citation_dict['document_ids'] if doc_id in documents]
del citation_dict['document_ids']

action_event.returns = citation_dict
action_event.end_timestamp = get_ISO_time()