Skip to content

Commit

Permalink
openai: use a public domain test image (#3294)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlhunter authored Jun 26, 2023
1 parent 39bb21e commit eeda4f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Binary file removed packages/datadog-plugin-openai/test/hal.png
Binary file not shown.
18 changes: 9 additions & 9 deletions packages/datadog-plugin-openai/test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1680,8 +1680,8 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('openai.request.method', 'POST')
expect(traces[0][0].meta).to.have.property('openai.request.endpoint', '/v1/images/edits')

expect(traces[0][0].meta).to.have.property('openai.request.mask', 'hal.png')
expect(traces[0][0].meta).to.have.property('openai.request.image', 'hal.png')
expect(traces[0][0].meta).to.have.property('openai.request.mask', 'ntsc.png')
expect(traces[0][0].meta).to.have.property('openai.request.image', 'ntsc.png')
expect(traces[0][0].meta).to.have.property('openai.request.prompt', 'Change all red to blue')
expect(traces[0][0].meta).to.have.property('openai.request.response_format', 'url')
expect(traces[0][0].meta).to.have.property('openai.request.size', '256x256')
Expand All @@ -1695,9 +1695,9 @@ describe('Plugin', () => {
})

const result = await openai.createImageEdit(
fs.createReadStream(Path.join(__dirname, 'hal.png')),
fs.createReadStream(Path.join(__dirname, 'ntsc.png')),
'Change all red to blue',
fs.createReadStream(Path.join(__dirname, 'hal.png')),
fs.createReadStream(Path.join(__dirname, 'ntsc.png')),
1,
'256x256',
'url',
Expand All @@ -1710,8 +1710,8 @@ describe('Plugin', () => {
status: 'info',
message: 'sampled createImageEdit',
prompt: 'Change all red to blue',
file: 'hal.png',
mask: 'hal.png'
file: 'ntsc.png',
mask: 'ntsc.png'
})

await checkTraces
Expand Down Expand Up @@ -1757,7 +1757,7 @@ describe('Plugin', () => {
expect(traces[0][0].meta).to.have.property('openai.request.method', 'POST')
expect(traces[0][0].meta).to.have.property('openai.request.endpoint', '/v1/images/variations')

expect(traces[0][0].meta).to.have.property('openai.request.image', 'hal.png')
expect(traces[0][0].meta).to.have.property('openai.request.image', 'ntsc.png')
expect(traces[0][0].meta).to.have.property('openai.request.response_format', 'url')
expect(traces[0][0].meta).to.have.property('openai.request.size', '256x256')
expect(traces[0][0].meta).to.have.property('openai.request.user', 'hunter2')
Expand All @@ -1770,14 +1770,14 @@ describe('Plugin', () => {
})

const result = await openai.createImageVariation(
fs.createReadStream(Path.join(__dirname, 'hal.png')), 1, '256x256', 'url', 'hunter2')
fs.createReadStream(Path.join(__dirname, 'ntsc.png')), 1, '256x256', 'url', 'hunter2')

expect(result.data.data[0].url.startsWith('https://')).to.be.true

expect(externalLoggerStub).to.have.been.calledWith({
status: 'info',
message: 'sampled createImageVariation',
file: 'hal.png'
file: 'ntsc.png'
})

await checkTraces
Expand Down
Binary file added packages/datadog-plugin-openai/test/ntsc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eeda4f8

Please sign in to comment.