mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-07-21 08:55:25 -04:00
99951bca92
* build: add examples-updater tool and update examples to v0.1.14-pre.1 Add a new tool to automate updating langchaingo version references in example projects and use it to update all examples to v0.1.14-pre.1. The tool also removes temporary replace directives that are no longer needed. - Add update-examples Makefile target that runs the new tool - Create internal/devtools/examples-updater implementation - Update all example go.mod files to reference v0.1.14-pre.1 - Remove replace directives in googleai and vertex examples - Update dependencies in main go.mod/go.sum * httprr: improve header normalization and test container setup Add header normalization to make HTTP recordings more stable: - Add normalizeGoogleAPIClientHeader and normalizeVersionHeader functions - Normalize User-Agent, x-goog-api-client and other version headers - Remove OpenAI-Project header for consistency - Preserve body for both replay lookup and recording - Add comprehensive tests for header normalization Improve testcontainer environment detection: - Better handling of non-standard Docker socket paths - Disable Ryuk reaper by default for resource efficiency - Add verbose logging option via environment variable * httputil: add ApiKeyTransport for query parameter API keys Add a reusable ApiKeyTransport that adds API keys to URL query parameters: - Create ApiKeyTransport implementation in httputil package - Add comprehensive tests for the new transport - Refactor googleai_test.go to use the shared transport - Update chains/llm_test.go to use ApiKeyTransport with proper key scrubbing This improves how API keys are handled with client libraries that don't properly set keys when using custom HTTP clients, particularly useful with httprr for testing Google API integrations. * openai: remove duplicate MaxTokens field assignment Remove redundant assignment where both MaxTokens and MaxCompletionTokens were being set to the same value. MaxCompletionTokens is the preferred field name that reflects OpenAI's API changes, while MaxTokens was previously kept for backward compatibility. * vectorstores/maridadb: add test infrastructure for MariaDB vectorstore Add TestMain function for MariaDB vectorstore tests that ensures the proper test environment is set up using the testctr package. This enables consistent test container setup and teardown for MariaDB integration tests. * all: normalize all httprr recordings for consistency Update test recordings across all packages to use normalized headers: - Standardize User-Agent to 'langchaingo-httprr' - Normalize version information in x-goog-api-client headers - Remove OpenAI-Project headers for consistency - Fix deprecated Anthropic completion API tests - Update HuggingFace test recordings with valid responses These changes make test recordings stable across dependency updates and different environments, preventing test failures from version changes. * devtools: add utility tool for normalizing httprr test recordings Add a command-line tool that standardizes version information in httprr recordings: - Normalizes x-goog-api-client headers to use placeholder versions - Standardizes x-amz-user-agent headers for consistency - Replaces Go version strings with generic placeholders - Supports dry-run mode to preview changes without modifying files - Includes verbose output option for detailed change reporting This tool helps maintain consistent test recordings across different environments and dependency versions, preventing test failures from version changes. * llms/openai: update OpenAI embedding test to use text-embedding-3-small model Update the embedding test to use the current text-embedding-3-small model: - Change model from text-embedding-ada-002 to text-embedding-3-small - Adjust dimensions parameter from 1234 to 256 to match model capabilities - Update test recording with appropriate response data This change ensures tests remain compatible with OpenAI's current embedding models and prevents test failures from API version changes.
69 lines
3.9 KiB
Plaintext
Generated
69 lines
3.9 KiB
Plaintext
Generated
httprr trace v1
|
|
2269 1734
|
|
POST https://api.openai.com/v1/chat/completions HTTP/1.1
|
|
Host: api.openai.com
|
|
User-Agent: langchaingo-httprr
|
|
Content-Length: 2066
|
|
Authorization: Bearer test-api-key
|
|
Content-Type: application/json
|
|
|
|
{"model":"gpt-4o","messages":[{"role":"user","content":"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n\nOverall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n\nTOOLS:\n------\n\nAssistant has access to the following tools:\n\n- calculator: Useful for getting the result of a math expression. \n\tThe input to this tool should be a valid mathematical expression that could be executed by a starlark evaluator.\n\n\n\nTo use a tool, please use the following format:\n\nThought: Do I need to use a tool? Yes\nAction: the action to take, should be one of [calculator]\nAction Input: the input to the action\nObservation: the result of the action\n\nWhen you have a response to say to the Human, or if you do not need to use a tool, you MUST use the format:\n\nThought: Do I need to use a tool? No\nAI: [your response here]\n\n\nBegin!\n\nPrevious conversation history:\n\n\nNew input: Hi! my name is Bob and the year I was born is 1987\n\nThought:"}],"temperature":0,"stop":["\nObservation:","\n\tObservation:"]}HTTP/2.0 200 OK
|
|
Content-Length: 963
|
|
Access-Control-Expose-Headers: X-Request-ID
|
|
Alt-Svc: h3=":443"; ma=86400
|
|
Cf-Cache-Status: DYNAMIC
|
|
Content-Type: application/json
|
|
Date: Mon, 18 Aug 2025 13:31:43 GMT
|
|
Openai-Organization: lcgo-tst
|
|
Openai-Processing-Ms: 1224
|
|
Openai-Project: proj_qm9GQ7k7ESiwosypKZaDuaoq
|
|
Openai-Version: 2020-10-01
|
|
Server: cloudflare
|
|
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
|
|
X-Content-Type-Options: nosniff
|
|
X-Envoy-Upstream-Service-Time: 1330
|
|
X-Ratelimit-Limit-Requests: 10000
|
|
X-Ratelimit-Limit-Tokens: 30000000
|
|
X-Ratelimit-Remaining-Requests: 9999
|
|
X-Ratelimit-Remaining-Tokens: 29999521
|
|
X-Ratelimit-Reset-Requests: 6ms
|
|
X-Ratelimit-Reset-Tokens: 0s
|
|
X-Request-Id: req_b3a289fc668949b4ae917220d9b87386
|
|
|
|
{
|
|
"id": "chatcmpl-C5uFaywx2I0i2aAUWIYkfmdDFwEdJ",
|
|
"object": "chat.completion",
|
|
"created": 1755523902,
|
|
"model": "gpt-4o-2024-08-06",
|
|
"choices": [
|
|
{
|
|
"index": 0,
|
|
"message": {
|
|
"role": "assistant",
|
|
"content": "Do I need to use a tool? No\nAI: Hi Bob! It's nice to meet you. If you were born in 1987, that would make you 36 years old in 2023. How can I assist you today?",
|
|
"refusal": null,
|
|
"annotations": []
|
|
},
|
|
"logprobs": null,
|
|
"finish_reason": "stop"
|
|
}
|
|
],
|
|
"usage": {
|
|
"prompt_tokens": 393,
|
|
"completion_tokens": 50,
|
|
"total_tokens": 443,
|
|
"prompt_tokens_details": {
|
|
"cached_tokens": 0,
|
|
"audio_tokens": 0
|
|
},
|
|
"completion_tokens_details": {
|
|
"reasoning_tokens": 0,
|
|
"audio_tokens": 0,
|
|
"accepted_prediction_tokens": 0,
|
|
"rejected_prediction_tokens": 0
|
|
}
|
|
},
|
|
"service_tier": "default",
|
|
"system_fingerprint": "fp_ea40d5097a"
|
|
}
|