Skip to content

Commit

Permalink
some more fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
the-praxs committed Aug 10, 2024
1 parent 42b73ed commit 2f9cde3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions agentops/llm_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,12 @@ def handle_stream_chunk(chunk: Message):
self.llm_event.model = kwargs["model"]
self.llm_event.prompt = kwargs["messages"][0]["content"]
self.llm_event.prompt_tokens = chunk.message.usage.input_tokens
self.llm_event.completion = ""
elif isinstance(chunk, RawContentBlockStartEvent):
self.llm_event.completion = {
"role": "assistant",
"content": chunk.content_block.text,
"role": chunk.message.role,
"content": "", # Always returned as [] in the this instance type
}
elif isinstance(chunk, RawContentBlockStartEvent):
self.llm_event.completion["content"] += chunk.content_block.text
elif isinstance(chunk, RawContentBlockDeltaEvent):
self.llm_event.completion["content"] += chunk.delta.text
elif isinstance(chunk, RawContentBlockStopEvent):
Expand Down Expand Up @@ -1276,15 +1276,15 @@ def override_api(self):

if module_version is None:
logger.warning(
f"Cannot determine Anthropic version. Only Anthropic>=0.0.1 supported."
f"Cannot determine Anthropic version. Only Anthropic>=0.32.0 supported."
)

if Version(module_version) >= parse("0.32.0"):
self.override_anthropic_sync_completion()
self.override_anthropic_async_completion()
else:
logger.warning(
f"Only Anthropic>=0.0.1 supported. v{module_version} found."
f"Only Anthropic>=0.32.0 supported. v{module_version} found."
)

def stop_instrumenting(self):
Expand Down

0 comments on commit 2f9cde3

Please sign in to comment.