Skip to content

Conversation

@xrmx
Copy link
Member

@xrmx xrmx commented Dec 17, 2024

What does this pull request do?

Add examples for instrumenting chat and embeddings calls.

Related issues

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

thanks for pulling this in!

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

Sorry to make polishing suggestions, but below aligns things a bit better.

While arbitrary, when I originally asked chat about a geography question, I intended something more esoteric than the falklands. Recent versions of the presentation use Bouvet Island, which is what I meant to put in the first place.

Copy link
Contributor

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

prefer the .env being there to match upstream examples which are less steps due to it


```
opentelemetry-instrument python use_openai.py
# "examples/chat.py" is a simple script using the openai client library.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just say something like this? that way we don't need to drift or repeat instructions about things like ENV vars?

See our examples for a quick start

Copy link
Member Author

@xrmx xrmx Dec 18, 2024

Choose a reason for hiding this comment

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

Sorry, I don't understand 😅, do you mean to replace this block with a reference to the examples or just replace this comment with "see our examples for a quick start"?

Copy link
Contributor

Choose a reason for hiding this comment

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

made a top-level comment here #45 (comment)

I'll propose an alternative PR here and into elastic-otel-python..

# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# OTEL_EXPORTER_OTLP_PROTOCOL=grpc

OTEL_SERVICE_NAME=opentelemetry-python-openai
Copy link
Member Author

Choose a reason for hiding this comment

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

@codefromthecrypt So this should be openai-example right?

Copy link
Contributor

Choose a reason for hiding this comment

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

yep

@codefromthecrypt
Copy link
Contributor

after thinking about this with @trentm etc I think maybe it would be better to put the example into an openai directory here https://github.com/elastic/elastic-otel-python/tree/main/examples

Then, the copy of examples in this directory can reference relative path for the instrumentation, and have that in the requirements.txt. In other words, the examples copy here could be used to test-drive the current code (keeping README in-tact), while the copy of examples in the EDOT tree are the end-user first start which use whatever the current version of EDOT is.

@xrmx xrmx marked this pull request as draft December 19, 2024 13:47
@codefromthecrypt
Copy link
Contributor

so the EDOT driven examples were merged here elastic/elastic-otel-python#226, so we can revert this to examples that use package references relative to the source directory as I think was done initially. I'll give a try porting

@xrmx xrmx closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants