diff --git a/js/DEVELOPMENT.md b/js/DEVELOPMENT.md new file mode 100644 index 000000000..32fd6b4e9 --- /dev/null +++ b/js/DEVELOPMENT.md @@ -0,0 +1,10 @@ +## Development + +This project is built using [pnpm](https://pnpm.io/) in conjunction with [changesets](https://pnpm.io/using-changesets). To install dependencies, run `pnpm install`. + +## Publishing + +```shell +npx changeset # create a changeset +pnpm -r publish # publish to npm +``` diff --git a/spec/llm_spans.md b/spec/llm_spans.md index 369a6f5d2..0f5081522 100644 --- a/spec/llm_spans.md +++ b/spec/llm_spans.md @@ -2,10 +2,50 @@ LLM spans capture the API parameters sent to a LLM provider such as OpenAI or Cohere. - ## Examples A span that includes tool calls and messages + ```json -{"name": "llm", "context": {"trace_id": "409df945-e058-4829-b240-cfbdd2ff4488", "span_id": "01fa9612-01b8-4358-85d6-e3e067305ec3"}, "span_kind": "LLM", "parent_id": "2fe8a793-2cf1-42d7-a1df-bd7d46e017ef", "start_time": "2024-01-11T16:45:17.982858-07:00", "end_time": "2024-01-11T16:45:18.517639-07:00", "status_code": "OK", "status_message": "", "attributes": {"llm.input_messages": [{"message.role": "system", "message.content": "You are a Shakespearean writing assistant who speaks in a Shakespearean style. You help people come up with creative ideas and content like stories, poems, and songs that use Shakespearean style of writing style, including words like \"thou\" and \"hath\u201d.\nHere are some example of Shakespeare's style:\n - Romeo, Romeo! Wherefore art thou Romeo?\n - Love looks not with the eyes, but with the mind; and therefore is winged Cupid painted blind.\n - Shall I compare thee to a summer's day? Thou art more lovely and more temperate.\n"}, {"message.role": "user", "message.content": "what is 23 times 87"}], "llm.model_name": "gpt-3.5-turbo-0613", "llm.invocation_parameters": "{\"model\": \"gpt-3.5-turbo-0613\", \"temperature\": 0.1, \"max_tokens\": null}", "output.value": "{\"tool_calls\": [{\"id\": \"call_Re47Qyh8AggDGEEzlhb4fu7h\", \"function\": {\"arguments\": \"{\\n \\\"a\\\": 23,\\n \\\"b\\\": 87\\n}\", \"name\": \"multiply\"}, \"type\": \"function\"}]}", "output.mime_type": "application/json", "llm.output_messages": [{"message.role": "assistant", "message.tool_calls": [{"tool_call.function.name": "multiply", "tool_call.function.arguments": "{\n \"a\": 23,\n \"b\": 87\n}"}]}], "llm.token_count.prompt": 229, "llm.token_count.completion": 21, "llm.token_count.total": 250}, "events": [], "conversation": null} +{ + "name": "llm", + "context": { + "trace_id": "409df945-e058-4829-b240-cfbdd2ff4488", + "span_id": "01fa9612-01b8-4358-85d6-e3e067305ec3" + }, + "span_kind": "LLM", + "parent_id": "2fe8a793-2cf1-42d7-a1df-bd7d46e017ef", + "start_time": "2024-01-11T16:45:17.982858-07:00", + "end_time": "2024-01-11T16:45:18.517639-07:00", + "status_code": "OK", + "status_message": "", + "attributes": { + "llm.input_messages": [ + { + "message.role": "system", + "message.content": "You are a Shakespearean writing assistant who speaks in a Shakespearean style. You help people come up with creative ideas and content like stories, poems, and songs that use Shakespearean style of writing style, including words like \"thou\" and \"hath\u201d.\nHere are some example of Shakespeare's style:\n - Romeo, Romeo! Wherefore art thou Romeo?\n - Love looks not with the eyes, but with the mind; and therefore is winged Cupid painted blind.\n - Shall I compare thee to a summer's day? Thou art more lovely and more temperate.\n" + }, + { "message.role": "user", "message.content": "what is 23 times 87" } + ], + "llm.model_name": "gpt-3.5-turbo-0613", + "llm.invocation_parameters": "{\"model\": \"gpt-3.5-turbo-0613\", \"temperature\": 0.1, \"max_tokens\": null}", + "output.value": "{\"tool_calls\": [{\"id\": \"call_Re47Qyh8AggDGEEzlhb4fu7h\", \"function\": {\"arguments\": \"{\\n \\\"a\\\": 23,\\n \\\"b\\\": 87\\n}\", \"name\": \"multiply\"}, \"type\": \"function\"}]}", + "output.mime_type": "application/json", + "llm.output_messages": [ + { + "message.role": "assistant", + "message.tool_calls": [ + { + "tool_call.function.name": "multiply", + "tool_call.function.arguments": "{\n \"a\": 23,\n \"b\": 87\n}" + } + ] + } + ], + "llm.token_count.prompt": 229, + "llm.token_count.completion": 21, + "llm.token_count.total": 250 + }, + "events": [] +} ```