Commit Graph

110 Commits

Author SHA1 Message Date
Brian Hackett
3c3a97aa50
Show information about anthropic calls when clicking usage (#34) 2025-02-19 16:19:42 -08:00
Chris Toshok
4795d02150
instrument whether an api key is the user's or ours (#33)
introduce an `AnthropicApiKey` type so we aren't passing a string/boolean everywhere.
2025-02-19 13:58:40 -08:00
Chris Toshok
8d3a8eeb3a
use AsyncLocalStorageContextManager to propagate trace context around (#32)
I noticed that the `llm.chat.*_tokens` attributes weren't in spans, and it turns out none of the attributes from the wrapped function make it in.  only those added synchronously from within `wrapWithSpan` do.

A few things in play here:

1. Switch from `ZoneContextManager` (which doesn't work with native async/await) to `AsyncLocalStorageContextManager` (which does.)
2. (1) requires we use a pnpm patch, since wrangler requires that we import `async_hooks` statically, and the otel code `requires` it, and also requires that it's spelled `node:async_hooks`.
3. encode the payload we try to send _before_ doing the retry loop, so we don't re-encode for each attempt.
4. switch from `startActiveSpan` to `context.with` + `startSpan`.  The latter allows us to wrap an async function.  the former is for synchronous functions.
2025-02-19 06:49:32 -08:00
Chris Toshok
c52ae1f9da
Fix otel errors (#31)
Running the prior code in wrangler (but _not_ `npm run dev`) was generating errors during otel initialization.  I was ultimately unable to figure out why, or how to fix them:

```
  (warn) Initializing OpenTelemetry
  (error) Error initializing OpenTelemetry TypeError: Class constructor OTLPExporterBase2 cannot be invoked without 'new'
```

In the end, it was easier to just boil the ocean a little:  With claude's help, write a custom otlp exporter and use that.  Also use BasicTracerProvider instead of WebTracerProvider.

This version is enough to generate spans from within local wrangler.
2025-02-18 16:18:03 -08:00
Brian Hackett
76059dc19c otel changes 2025-02-18 12:40:44 -08:00
Brian Hackett
c00ad7792c more logging 2025-02-18 12:16:01 -08:00
Brian Hackett
ab614ee90a Telemetry diagnostics 2025-02-18 12:12:12 -08:00
Chris Toshok
d81ab41688
warn that otel wasn't initialized properly, every time we would have sent a span (#30)
The log should contain a warning showing the following once at startup:
```
OpenTelemetry initialization skipped: HONEYCOMB_API_KEY and/or HONEYCOMB_DATASET not set
```
and every time a span would have been created:
```
OpenTelemetry not initialized, skipping span creation
```

Also sneak in a `service.version` attribute that is `${__APP_VERSION}; ${__COMMIT_HASH}`.  e.g.:
![image](https://github.com/user-attachments/assets/6f111cb1-8fb9-46c4-9bd8-24bdd08650ab)
2025-02-18 12:00:38 -08:00
Chris Toshok
af4c405620
[PRO-973] basic o11y around anthropic api calls (#22)
add some otel initialization, pointing at honeycomb + a function to wrap other functions with spans.  use that function to wrap `callAnthropic` and add some context (number of messages sent, token usage, along with some metadata should we ever support other providers.)

The honeycomb api key/dataset are to be passed via env vars `HONEYCOMB_API_KEY` and `HONEYCOMB_DATASET` respectively.
2025-02-18 10:06:20 -08:00
Brian Hackett
20bb97c0c5
Fix assorted problems (#27) 2025-02-14 14:27:20 -08:00
Brian Hackett
b2efa3b56d Fixes for partial update handling 2025-02-13 16:34:30 -08:00
Brian Hackett
2f2a239660
Avoid losing code when prompting AI (#24) 2025-02-13 09:36:22 -08:00
Brian Hackett
7d02bb58fc Ignore package-lock.json 2025-01-22 15:26:40 -08:00
Brian Hackett
e014056030 Refactor getModelInstance call outside of getStreamTextArguments so we don't need an API key for the selected model if we're using claude 2025-01-16 08:47:07 -08:00
Brian Hackett
6543f33d54
Fixes for cloudflare deployment (#3) 2025-01-14 13:07:23 -08:00
Brian Hackett
c3e1764da3
Merge pull request #1 from replayio/recording-button
Add button to save recording, assorted other UX changes
2025-01-07 05:56:18 -10:00
Anirban Kar
7295352a98
refactor: refactored LLM Providers: Adapting Modular Approach (#832)
* refactor: Refactoring Providers to have providers as modules

* updated package and lock file

* added grok model back

* updated registry system
2024-12-21 11:45:17 +05:30
Anirban Kar
3e2fc32a46
Merge branch 'main' into fix/described_by 2024-12-19 18:02:43 +05:30
Anirban Kar
d37c3736d5 removed logs 2024-12-18 21:34:18 +05:30
Anirban Kar
283eb22ae5 added indicator on settings menu 2024-12-18 20:04:43 +05:30
Anirban Kar
62ebfe51a6 fix: .env file baseUrl Issue 2024-12-18 16:34:18 +05:30
Anirban Kar
9f5c01f5dd
Merge branch 'main' into system-prompt-variations 2024-12-15 21:01:52 +05:30
Anirban Kar
70f88f981a feat: Experimental Prompt Library Added 2024-12-15 16:47:16 +05:30
Meet Patel
8bcd82c9d4 feat: added perplexity model 2024-12-14 11:59:10 +05:30
kris1803
2064c83177 Fixed console error for SettingsWIndow & Removed ts-nocheck where not needed 2024-12-14 00:39:27 +01:00
Anirban Kar
456c89429a fix: removed context optimization temporarily, to be moved to optional from menu 2024-12-14 02:25:36 +05:30
Anirban Kar
8c4397a19f
Merge pull request #578 from thecodacus/context-optimization
feat(context optimization): Optimize LLM Context Management and File Handling
2024-12-14 02:08:43 +05:30
Anirban Kar
104291c652
Update prompts.ts 2024-12-12 03:28:51 +05:30
Evan
78eccf242b
fix: re-capitalize "NEW" 2024-12-11 16:54:08 -05:00
Evan
50c384f2b1
fix: grammar 2024-12-11 16:49:24 -05:00
Evan
db9cd9b296
fix: grammar/typos in system prompt 2024-12-11 16:46:54 -05:00
Anirban Kar
da37d9456f Merge branch 'main' into context-optimization 2024-12-12 02:44:36 +05:30
Anirban Kar
5d4b860c94 updated to adapth baseurl setup 2024-12-11 14:02:21 +05:30
Anirban Kar
dfbbea110e removed console logs 2024-12-10 14:27:12 +05:30
Anirban Kar
ea5c6244a6 feat(context optimization):improved context management and redused chat overhead 2024-12-07 15:58:13 +05:30
Anirban Kar
f562984dc6
Merge pull request #533 from wonderwhy-er/harcode-together-ai-api-url-as-fallback
(ready for review)Harcode together ai api url as fallback
2024-12-06 17:01:02 +05:30
Anirban Kar
7efad13284 list fix 2024-12-06 16:58:04 +05:30
Anirban Kar
5ead47992d
Merge branch 'main' into together-ai-dynamic-model-list 2024-12-06 16:35:36 +05:30
eduardruzga
e5d52de5a5 Hardcode url for together ai as fallback if not set in env 2024-12-04 17:56:50 +02:00
Anirban Kar
1589d2a8f5 feat(Dynamic Models): together AI Dynamic Models 2024-12-03 02:13:33 +05:30
Andrew Trokhymenko
235747af51 merge with upstream 2024-12-02 14:55:43 -05:00
Dustin Loring
92918d1c14
Merge pull request #7 from ibrain-one/feature/307-together-ai-integration
feat: add Together AI integration and provider implementation guide
2024-12-01 11:34:37 -05:00
Andrew Trokhymenko
7cdb56a847 merge with upstream/main 2024-11-29 22:02:35 -05:00
Oliver Jägle
ad511db0fe
Don't fix linting-issues pre-commit
I figured that lint:fix might not be the best experience: If there are linting errors and the pre-commit fixes them, those changes will stay in the staging area but will not be automatically commited.
Thus, a subsequent pre-commit check would succeed without these changes included.
2024-11-23 10:11:00 +01:00
Martin Ouimet
76cc7a8139 feat: add Together AI integration and provider implementation guide
- Create detailed provider implementation guide with:
  - Architecture overview and implementation steps
  - Configuration patterns and best practices
  - Testing checklist and Docker integration guide
  - Example using Together AI implementation
- Add Together AI as new provider with:
  - Environment variables and Docker configuration
  - Support for Qwen, Llama, and Mixtral models
  - API key and base URL management
  - OpenAI-compatible API integration
2024-11-23 00:20:35 -05:00
Oliver Jägle
4589014bda
Merge remote-tracking branch 'upstream/main' into linting 2024-11-22 20:38:58 +01:00
Oliver Jägle
5bd4541abf
Lint and fix recent changes from main 2024-11-22 17:48:46 +01:00
Oliver Jägle
a203f4c34b
Merge remote-tracking branch 'upstream/main' into linting 2024-11-22 12:25:39 +01:00
Oliver Jägle
7d8f811886
Fix linting issues 2024-11-22 09:49:45 +01:00
Andrew Trokhymenko
074161024d merge with upstream 2024-11-21 23:31:41 -05:00