Hi, I wanted to ask that I'm logging all the data to mongodb which I can load directly in the server, I was trying to do that with log_traces but it'll require me to run cron jobs, Is there a way I can import from mongodb in docker directly?
Hi Anuraag, unfortunately we don鈥檛 plan on supporting loading directly from mongo, if this is something that鈥檚 very important you can file a feature request but I鈥檇 strongly suggest setting projects with the resource directly
Oh, thank you will check if this feature is really needed or there can be some bypass I can do. Can You help me with the docker build failing? I'm trying to re-build the docker image with some changes to the source code but its failing to build giving me this error(attached image).
ah if you're building directly from source you need to remove the symlink at phoenix/evals
we include it for developer convenience, since it links to the phoenix.evals package in the same repo
Oh, should I replace it with anything or just delete it completely?
just delete it, it's only there for local developer installs
Sure, Thanks again, will let you know if I get any issues.
Dustin N. Sorry for ping, but Are openai streaming response supported with OpenAIInstrumentor? I'm having trouble tracing the streaming responses.
They should be! What is the trouble you're seeing Anuraag T.?
When I'm running my simple AzureOpenAI chat completion, I can see that it gets tracked but when I add stream=True in the chat completion it no longer tracks it, the traces in project does not update.
Here is the basic snippet of what I'm using:
import os
from openai import AzureOpenAI
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from phoenix.trace.openai import OpenAIInstrumentor
os.environ["PHOENIX_PROJECT_NAME"] = "dummyDemo"
os.environ["PHOENIX_HOST"] = "http://127.0.0.1:6006"
os.environ["PHOENIX_PORT"] = "6006"
os.environ["PHOENIX_COLLECTOR_ENDPOINT"] = "http://127.0.0.1:6006"
OpenAIInstrumentor().instrument()
azure_credential = DefaultAzureCredential()
token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default")
client = AzureOpenAI(
azure_endpoint="azure_endpoint",
azure_ad_token_provider=token_provider,
api_version="2024-02-01",
)
def run_test():
conversation = [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello, can you help me with something?"}]
# Generate a response from the assistant
response = client.chat.completions.create(
model="gpt-4-32k",
messages=conversation,
stream=True,
# stream_options={"include_usage": True},
)
# print(response.choices[0].message.content)
result = ""
for chunk in response:
result += chunk.choices[0].delta.content
print("ran instrument func.:", result)
return result
def main():
while True:
user_input = input("Enter `abc` to run: ")
if user_input == "abc":
run_test()
main()
Is the stream fully consumed? You won鈥檛 get the span until the stream is finished and the span is closed
Oh, my bad, I thought it'll track the stream without consuming 馃槄. Thanks
No problem!
